MsgBox

From NSB App Studio
Revision as of 18:14, 8 July 2012 by Brendon (talk | contribs) (Created page with "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 whic...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Related Items

INPUTBOX