Input and Message Boxes PowerPoint PPT Presentation

presentation player overlay
1 / 9
About This Presentation
Transcript and Presenter's Notes

Title: Input and Message Boxes


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
(No Transcript)
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
Write a Comment
User Comments (0)
About PowerShow.com