Pages

Friday, June 08, 2007

Setting Default & Cancel Buttons in VBA/Visual Basic

VB/ VBA Setting Default & Cancel Buttons through code

Private Sub Form_Load()

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

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

End Sub

For doing the same in VB.Net Refer : http://dotnetdud.blogspot.com/2007/06/vbnet-setting-default-cancel-buttons.html

2 comments:

  1. mdlueck6:47 AM

    Just what I was looking for with VBA in Access 2007. Thank you!

    ReplyDelete
  2. loatEsc11:05 AM

    I need the same but working with pages. I mean in a Page_Load event.
    Thanks in advance

    ReplyDelete