How to add conditions to the YES NO Message Box
To add conditions to the YES NO Message Box
Step 1:
Add the Command Button to the Form.
Step 2:
Write the VB programming codes for the Command Button. Add conditions to Yes and No buttons:
Private Sub Command1_Click()
a = MsgBox("Yes/No?", vbYesNo)
If a = vbYes Then
Print "You Click Yes Button"
Else
Print "You Click No Button"
End If
End Sub
Step 3:
In this example, Yes/No message box is displayed. Clicking on Yes or No button to displayed different words on the form:
No comments:
Post a Comment