MsgBox: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
MSGBOX(''prompt''[, ''okCancel''])
MsgBox(''prompt''[, ''okCancel''])


'''Description'''
== Description ==


MSGBOX opens a dialog box, and waits for the user to tap on a button. The return value is an integer that indicates which button was tapped. The required parameter, ''prompt'', is a string expression that is displayed in the body of the dialog box. The optional parameter, ''okCancel'', is a numeric or constant expression that specifies whether to ask the user to choose between a Cancel and OK. The default value for okCancel is 0.
MsgBox opens a dialog box, and waits for the user to tap on a button. The return value is an integer that indicates which button was tapped. The required parameter, ''prompt'', is a string expression that is displayed in the body of the dialog box. The optional parameter, ''okCancel'', is a numeric or constant expression that specifies whether to ask the user to choose between a Cancel and Ok. The default value for okCancel is 0.


'''Table 15: okcancel constants'''
'''Table 15: okcancel constants'''
Line 27: Line 27:
|}
|}


'''Example'''
== Example ==


<pre>
<pre>
REM MSGBOX Example
Rem MsgBox Example
'MSGBOX displays a modal dialog box
'MsgBox displays a modal dialog box
DIM Continue
Dim Continue
MSGBOX("Hello World!")
MsgBox("Hello World!")
MSGBOX "Brief tour of MSGBOX", vbOK
MsgBox "Brief tour of MSGBOX", vbOK
Continue = MSGBOX("Continue tour?", 1)
Continue = MsgBox("Continue tour?", 1)
IF Continue = vbYes THEN
If Continue = vbYes Then
   Continue=MSGBOX("Short tour, huh?")
   Continue=MsgBox("Short tour, huh?")
END IF
END IF
Continue = MSGBOX("Repeat tour?", 1)
Continue = MSGBOX("Repeat tour?", 1)
IF Continue = vbCancel THEN
IF Continue = vbCancel THEN
   MSGBOX("Goodbye!")
   MSGBOX("Goodbye!")
END IF
End If
</pre>
</pre>


'''Output'''
== Output ==


[[MSGBOX:MSGBOX.jpg]]
[[MSGBOX:MSGBOX.jpg]]


'''Related Items'''
== Related Items ==


[[inputbox|INPUTBOX]]
[[inputbox|INPUTBOX]]
[[Category:Language Reference]]

Revision as of 02:21, 17 August 2012

MsgBox(prompt[, okCancel])

Description

MsgBox opens a dialog box, and waits for the user to tap on a button. The return value is an integer that indicates which button was tapped. The required parameter, prompt, is a string expression that is displayed in the body of the dialog box. The optional parameter, okCancel, is a numeric or constant expression that specifies whether to ask the user to choose between a Cancel and Ok. The default value for okCancel is 0.

Table 15: okcancel constants

Constant Value Description
vbOKOnly 0 OK Button only
vbOKCancel 1 OK and Cancel Buttons

Table 16: MSGBOX return values

Constant Value Description
vbOK 1 OK
vbCancel 2 Cancel

Example

Rem MsgBox Example
'MsgBox displays a modal dialog box
Dim Continue
MsgBox("Hello World!")
MsgBox "Brief tour of MSGBOX", vbOK
Continue = MsgBox("Continue tour?", 1)
If Continue = vbYes Then
   Continue=MsgBox("Short tour, huh?")
END IF
Continue = MSGBOX("Repeat tour?", 1)
IF Continue = vbCancel THEN
   MSGBOX("Goodbye!")
End If

Output

MSGBOX:MSGBOX.jpg

Related Items

INPUTBOX