MsgBox: Difference between revisions
Jump to navigation
Jump to search
Add javascript snippet |
|||
| Line 51: | Line 51: | ||
var Continue; | var Continue; | ||
alert("Hello World!"); | alert("Hello World!"); | ||
alert("Brief tour of MSGBOX"); | alert("Brief tour of MSGBOX"); | ||
Revision as of 02:32, 28 May 2013
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 (Basic)
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
Example (JavaScript)
// MsgBox Example
/* MsgBox displays a modal dialog box */
var Continue;
alert("Hello World!");
alert("Brief tour of MSGBOX");
Continue = confirm("Continue tour?")
if (Continue) {
Continue=confirm("Short tour, huh?");
}
Continue == confirm("Repeat tour?");
if (!Continue) {
alert("Goodbye!");
}
