Professional Documents
Culture Documents
VB Msgbox - MessageBox Function in Visual Basic 6
VB Msgbox - MessageBox Function in Visual Basic 6
VB Msgbox - MessageBox Function in Visual Basic 6
VB6 beginners tutorial Learn VB6 Advanced VB6 tutorial Learn Advanced VB6 Systems Analysis System analysis and Design tutorial for Software Engineering
You are he re :
Browse Topics
- Ge tting starte d - Data Type s - Module s - O pe rators in VB6 - VB6 Variable - VB6 Proce dure s - VB6 C ontrol Structure s - Loops in VB6 - VB6 Ex it Do & W ith End
W ith
Data Type s - VB6 C onstants - VB6 Built-in Functions - Date and Tim e in VB6
Displays a message in a dialog box and wait for the user to click a button, and returns an integer indicating which button the user clicked. Following is an expanded MessageBox
- Labe l & Fram e - Picture Box & Im age Box - Tim e r C ontrol - ListBox & C om boBox - VB6 ScrollBar - C ontrol Arrays in VB6 - File s controls in VB6 - VB6 C he ck Box - Form s in VB6 - Me nus in VB6 - MDI Form in VB6 - InputBox - Me ssage Box - Mouse e ve nts - Mouse Move - Error Handling - Error Handling (2) - VB6 Database
Syntax : MsgBox ( Prompt [,icons+buttons ] [,title ] ) memory_variable = MsgBox ( prompt [, icons+ buttons] [,title] ) Prompt : String expressions displayed as the message in the dialog box. If prompt consist of more than one line, you can separate the lines using the vbrCrLf constant. Icons + Buttons : Numeric expression that is the sum of values specifying the number and type of buttons and icon to display. Title : String expression displayed in the title bar of the dialog box. If you omit title, the application name is placed in the title bar. Icons Constant vbCritical vbQuestion vbExclamation vbInformation Buttons Constant vbOkOnly vbOkCancel vbAbortRetryIgnore vbYesNoCancel vbYesNo vbRetryCancel Value 0 1 2 3 4 5 Description Display OK button only Display OK and Cancel buttons Display Abort, Retry and Ignore buttons Display Yes, No and Cancel buttons Display Yes and No buttons Display Retry and Cancel buttons Value 16 32 48 64 Description Display Critical message icon Display Warning Query icon Display Warning message icon Display information icon
visualbasic.freetutes.com/learn-vb6/lesson18.html
1/3
21/08/13
Return Values Constant vbOk vbCancel vbAbort vbRetry vbIgnore vbYes vbNo Value 1 2 3 4 5 6 7 Ok Button Cancel Button Abort Button Retry Button Ignore Button Yes Button No Button Description
Following is an example illustrates the use of message boxes * Open a new Project and save the Form as messageboxdemo.frm and save the Project as messageboxdemo.vbp * Design the application as shown below. Object Form Property Caption Name Setting MessageBoxDemo frmMessageBoxDemo
Label
Caption Name
TextBox
Name Text
ListBox CommandButton
CommandButton
Caption Name
Delete cmdDelete
CommandButton
Caption Name
Exit cmdExit
Following code is entered in the txtName_Change ( ) event P r i v a t eS u bt x t N a m e _ C h a n g e ( ) I fL e n ( t x t N a m e . T e x t )>0T h e n c m d A d d . E n a b l e d=T r u e E n dI f E n dS u b Following code has to be entered in the cmdAdd_Click ( ) event P r i v a t eS u bc m d A d d _ C l i c k ( ) a n s w e r=M s g B o x ( " D oy o uw a n tt oa d dt h i sn a m et ot h el i s tb o x ? " ,v b E x c l a m a t i o n+v b Y e s N o , " A d dC o n f i r m " ) I fa n s w e r=v b Y e sT h e n
visualbasic.freetutes.com/learn-vb6/lesson18.html
2/3
21/08/13
Home | Link to Us | About Us | Privacy Policy | Contact Us Copyright Freetutes.com | All Rights Reserved
visualbasic.freetutes.com/learn-vb6/lesson18.html
3/3