MsgBox: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
(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...")
 
No edit summary
Line 46: Line 46:


'''Output'''
'''Output'''
[[File:MSGBOX.jpg]]


'''Related Items'''
'''Related Items'''


[[inputbox|INPUTBOX]]
[[inputbox|INPUTBOX]]

Revision as of 18:21, 8 July 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

Related Items

INPUTBOX