|
MsgBox Function
Displays a message in a dialog box and pauses until the user clicks a button.
String expression displayed as the message in the dialog box.
The maximum length of prompt is approximately 1024 characters, depending
on the width of the characters used. The syntax for MsgBox or message box is simple. You type the msgbox and double quoted string or variable. If more than one variables or strings are passed to the message box, you must use concatenation sign or it will not accept. Message box is able to display any type of values. For example: msgbox"Hello there" This message box display Hello there. dim name name="Mohamed A" msgbox "To the honor of: " &name This dialog box displays To the honor of Mohamed A. To view how message box look like, click the button bellow.
When you click on the button above, the dialog box appears has only OK button. This is the only default button but you can modify and display any button or buttons you wish to display. For example: msgbox"Do you want continue",vbYesNoCancel Display Yes, No, and Cancel buttons with the question.
msgbox"Wrong file name",vbRetryCancel Display Retry and Cancel.Number values can be used to display buttons on the dialog box. For example: The following example is similar to msgbox "Do you want to continue",vbYesNo.
msgbox"Do you want to continue",4 . Following are list of button arguments available in vbscript.
Constant |
Value |
Description |
vbOKOnly |
0 |
Display OK button only. |
vbOKCancel |
1 |
Display OK and Cancel buttons. |
vbAbortRetryIgnore |
2 |
Display Abort, Retry, and Ignore
buttons. |
vbYesNoCancel |
3 |
Display Yes, No, and Cancel buttons. |
vbYesNo |
4 |
Display Yes and No buttons. |
vbRetryCancel |
5 |
Display Retry and Cancel buttons. |
vbCritical |
16 |
Display Critical Message icon. |
vbQuestion |
32 |
Display Warning Query icon. |
vbExclamation |
48 |
Display Warning Message icon. |
vbInformation |
64 |
Display Information Message icon. |
vbDefaultButton1 |
0 |
First button is default. |
vbDefaultButton2 |
256 |
Second button is default. |
vbDefaultButton3 |
512 |
Third button is default. |
vbDefaultButton4 |
768 |
Fourth button is default. |
| More to come, stay toon |
Form Validations
Objects |
|