Syntax: MsgBox prompt [, buttons] [, title] [, helpfile, context]
Arguments:
Prompt: Message which you want to see on Dialog Box
Buttons: It is a Numeric Values, which specifies number and type of buttons to display and type of icon style to use. If button value is not stated, default value is Zero (0)
Title: Message which you want to see on Title Bar of Dialog Box
MsgBox Function returns one of the following values:
A. 1 = vbOK - OK was clicked
B. 2 = vbCancel - Cancel was clicked
C. 3 = vbAbort - Abort was clicked
D. 4 = vbRetry - Retry was clicked
E. 5 = vbIgnore - Ignore was clicked
F. 6 = vbYes - Yes was clicked
G. 7 = vbNo - No was clicked
Examples:
1. MsgBox "Hello everyone!",0,"Swarup Kumar"
Note: By default the button status is Zero (0)
2. MsgBox "Hello everyone!",1,"Swarup Kumar"
3. MsgBox "Hello everyone!",2,"Swarup Kumar"
4. MsgBox "Hello everyone!",3,"Swarup"
5. MsgBox "Hello everyone!",4,"Swarup Kumar"
6. MsgBox "Hello everyone!",5,"Swarup Kumar"
7. Printing two Message Lines on Dialog Box
MsgBox "Hello"& vbcrlf & "everyone!",1,"Swarup Kumar"
vbcrlf: Visual Basic Carriage Return Line Feed
Guidelines: Instead of 0 to 5 use 16 to 21 to display Critical Icon
1 comment:
Thank for sharing this. It is very helpful.
Post a Comment