Thursday 24 November 2011

VB.Net Setting Default & Cancel Buttons

Setting Default & Cancel Buttons in Visual Basic.Net Form

Default button is in VB.NEt with a different name - AcceptButton. However, cancel button retains its name:

Here is a way you can set them

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'Sets cmdOK as the button control that is clicked when the user presses the Enter key.
Me.AcceptButton = cmdOK

'Sets cmdCancel as the button control that is clicked when the user presses the ESC key.
Me.CancelButton = cmdCancel

End Sub

No comments:

Post a Comment