Presentation is loading. Please wait.

Presentation is loading. Please wait.

Input and Message Boxes. InputBox() Function An input box is a dialog box that opens and waits for the user to enter information. Syntax: InputBox(prompt[,title][,default])

Similar presentations


Presentation on theme: "Input and Message Boxes. InputBox() Function An input box is a dialog box that opens and waits for the user to enter information. Syntax: InputBox(prompt[,title][,default])"— Presentation transcript:

1 Input and Message Boxes

2 InputBox() Function An input box is a dialog box that opens and waits for the user to enter information. Syntax: InputBox(prompt[,title][,default]) Returns a string containing the contents of the text box

3 InputBox() Example Dim strMessage As String Dim strTitle As String Dim strDefault As String Dim strInput As String strMessage = “Enter a value between 1 and 3” strTitle = “InputBox Demo” strDefault = “1” strInput = InputBox(strMessage,strTitle,strDefault)

4 MsgBox() Function displays a message for the user to read returns a value that indicates which command button the user selected useful for program debugging

5 MsgBox Syntax Syntax : MsgBox(prompt[,buttons][,title]) The prompt is the only mandatory argument. This is the message that is displayed in the message box.

6 Buttons argument settings The first group of values (0 – 5) describes the number and type of buttons displayed in the dialog box. The second group (16, 32, 48, 64) describes the icon style. The third group (0, 256, 512) determines which button is the default. The fourth group (0, 4096) determines the modality of the message box.

7

8 MsgBox Example Dim strMsg, strTitle As String Dim intStyle, intResponse As Integer strMsg = "Do you want to continue ?” intStyle = vbYesNo + vbCritical + vbDefaultButton2 strTitle = "MsgBox Demonstration" intResponse = MsgBox(strMsg, intStyle, strTitle) lblResponse.Caption = intResponse

9 Return Values


Download ppt "Input and Message Boxes. InputBox() Function An input box is a dialog box that opens and waits for the user to enter information. Syntax: InputBox(prompt[,title][,default])"

Similar presentations


Ads by Google