I'm using messagebox wrong

need another set of eyes please, no matter what i choose it runs the “messagebox test1”

question = Rhino.MessageBox("Restore previous state?", 1)
If (question = 0) Then
      Call rhino.MessageBox("test1")
Else
      Call rhino.MessageBox("test2")      
End If
Call rhino.MessageBox("test3")

Hi,

Here it always returns “test2” (then “test3”) and that’s because “0” is not a possible return of MessageBox method, so 0 condition (test1) can never occur.

Take a look at the RETURNS in help section for this method:
MessageBox

Returns

Number An number indicating which button was clicked:

Value Description


1 OK button was clicked.
2 Cancel button was clicked.
3 Abort button was clicked.
4 Retry button was clicked.
5 Ignore button was clicked.
6 Yes button was clicked.
7 No button was clicked.

i don’t know what i was thinking, i totally read the help file wrong. :expressionless: