Changes

Dialogs and Message Boxes in VB6

3,007 bytes added, 20:05, 11 February 2008
The following lines were added (+) and removed (-):
== Common Dialog Control == == Message Boxes ==The MsgBox Function displays a message in a dialog box, waits for the user to click a button, and returns an Integer indicating which button the user clicked.  It can be used to provide information or prompt for a user decision.Syntax MsgBox(prompt[, buttons] [, title] [, helpfile, context])Constants* 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. * vbApplicationModal 0 Application modal; the user must respond to the message box before continuing work in the current application. * vbSystemModal 4096 System modal; all applications are suspended until the user responds to the message box. * vbMsgBoxHelpButton 16384 Adds Help button to the message box * VbMsgBoxSetForeground 65536 Specifies the message box window as the foreground window * vbMsgBoxRight 524288 Text is right aligned * vbMsgBoxRtlReading 1048576 Specifies text should appear as right-to-left reading on Hebrew and Arabic systemsReturn Values;* Constant Value Description * vbOK 1 OK * vbCancel 2 Cancel * vbAbort 3 Abort * vbRetry 4 Retry * vbIgnore 5 Ignore * vbYes 6 Yes * vbNo 7 NoDisplay a popup alert with a message and OK button:  MsgBox "Invalid input!"The OK CANCEL dialog:  iYN = Msg("Click OK to Proceed". vbOkCancel,"Startup Menu")An Alert with YES, NO, and CANCEL (! graphic):  iYN = MsgBox("Click to Test", vbYesNoCancel + vbExclamation, "Test Message")Simple exit program confirm  Private Sub Command1_Click()    Select Case MsgBox("Do you really wish to quit this program?", vbOKCancel + vbQuestion, "Confirmation")      Case vbOK        Unload Me    End Select  End Sub== The Input Box ==An InputBox( ) function will display a message box where the user can enter a value or a message in the form of text.Format:  myMessage=InputBox(Prompt, Title, default_text, x-position, y-position)* Prompt      - The message displayed normally as a question asked.* Title            - The title of the Input Box.* default-text  - The default text that appears in the input field where users can use it as his intended input or he may change to the message he wish to key in.* x-position and y-position - the position or the coordinate of the input box.Example userMsg = InputBox("What is your message?", "Message Entry Form", "Enter your messge here", 500, 700) 
Bureaucrat, administrator
16,192
edits