Pages

Wednesday, 19 October 2011

QTP Script: How to display and use various types of dialog box.


' display a basic message box
MsgBox "Hi, this is a message box"vbOkOnly"Message Title"


' prompt the user with a question
strAnswer = InputBox("Hi, how are you today?","Question")
' show the user what they just typed
MsgBox "You are - " & strAnswer


' ask the user to select an option
strAnswer = MsgBox("Do you want to proceed?"vbYesNo"Question")
' show the user what they just selected
If strAnswer = vbNo Then
    MsgBox "You selected No"
Else
    MsgBox "You selected Yes"
End If

 

 

Note: Here are the various message types you can play with...

 

vbOKOnly
vbOKCancel
vbAbortRetryIgnore
vbYesNoCancel
vbYesNo
vbRetryCancel
vbCritical
vbQuestion
vbExclamation
vbInformation


0 comments:

Post a Comment