Tuesday, December 11, 2007

How to control the default Button on the Message Box with Value 1

How to control the default Button on the Message Box with Value 1

To control the default Button on the Message Box with Value 1

Step 1:

Add the CommandButton in the Form:

Step 2:

Type in VB programming codes to the Command button. In this example, a Message box will be displayed after clicking on the Command button:

Private Sub Command1_Click()

MsgBox "Hello", 1 + vbDefaultButton2

End Sub

Step 3:

The Message box with 'OK' and 'Cancel' is displayed after clicking on the Command button.

No comments: