1 / 9

Input and Message Boxes

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]) Returns a string containing the contents of the text box. InputBox() Example. Dim strMessage As String

latika
Télécharger la présentation

Input and Message Boxes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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. 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

  8. Return Values

More Related