Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

messagebox question

Status
Not open for further replies.

misulica

Programmer
Feb 8, 2003
43
RO
MESSAGEBOX("You choose ?thisform.spinner1.value? objects", 4+48, "ATTENTION")

What I must place instead of ? to obtain the number selected from spinner?
 
misulica

If You are using VFP7.0 the INPUTBOX() would help you, otherwise in VFP6.0 you can on return the results of pressing on the buttons at the bottom of the messagebox. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Yes, I'm using VFP7.
I want to display something like:
You choose 5 objects
 
Misulica,

try
Code:
MESSAGEBOX("You choose " + STR(thisform.spinner1.value) +  " objects", 4+48, "ATTENTION")
 
misulica

Sorry I misunderstood the question. MadTown has a suggestion for you. You may have to ALLTRIM also your spinner value, or you'll ened up with a few extra spaces. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
It works, one little problem.The message displayed is:
You choose 5objects
 
misulica

Did you use ALLTRIM as I suggest?

MESSAGEBOX("You choose " + ALLTRIM(STR(thisform.spinner1.value)) + " objects", 4+48, "ATTENTION")
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Code:
MESSAGEBOX("You choose " + ALLTRIM(STR(thisform.spinner1.value)) +  " objects", 4+48, "ATTENTION")

also make sure there is a space between " and the o in objecs


 
Works fine.I'm ashamed, but I have another question:
The message box have 2 buttons: Yes + No
What kind of code do I give to each button to perform what they display:
Yes - then go on (I agree with those 5 objects)
No - then stop and return to form to select another number from the spinner
 
LOCAL lnReturn
lnReturn=MESSAGEBOX("You choose " + ALLTRIM(STR(thisform.spinner1.value)) + " objects", 4+48, "ATTENTION")

if lnReturn = 6 &&(The user pressed yes)
&& Do something
else
&& Do something else
endif



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Misulica,
The MessageBox returns a value that corresponds to which button was pushed

So write it like

Code:
IF MessageBox(("You choose " + ALLTRIM(STR(thisform.spinner1.value))
 +  " objects", 4+48, "ATTENTION") = 6
   *** user pressed yes ***
ELSE
   *** user pressed no
ENDIF

 
MadTown

IF MessageBox(("You choose " + ALLTRIM(STR(thisform.spinner1.value))
+ " objects", 4+48, "ATTENTION") = 6
*** user pressed yes ***
ELSE
*** user pressed no
ENDIF


This causes an error, have you tested it, before posting it?
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike, What kind of error? I get no error when running this. Could it be due to the command wrapping to the next line?
 
MadTown

IF MessageBox(("You choose " + ALLTRIM(STR(thisform.spinner1.value))+ " objects", 4+48, "ATTENTION") = 6

Count the blue brackets and the red. One too many blues. Take the first blue one out. If you copy the whole above line, one one single line and compile. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike, Madtown,
I believe there is an extra "(" and of course you may need a ";" based on the formatting:
Code:
IF MessageBox("You choose " + ALLTRIM(STR(thisform.spinner1.value)) ;
 +  " objects", 4+48, "ATTENTION") = 6
   *** user pressed yes ***
ELSE
   *** user pressed no
ENDIF
Rick
 
You're welcome - it's obvious Mike can type faster than I can! :)

Rick
 
Rick

You're welcome - it's obvious Mike can type faster than I can!

And in color with that!!
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top