Press 'Enter' key and fire a button event in vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • somtabu
    New Member
    • Nov 2006
    • 15

    Press 'Enter' key and fire a button event in vb.net

    i have a vb.net windows application. there are a some text field and a buton in the buttom of the page.... i want to fire button event when i press ENTER key where as my cursor is any where in the text field.....

    Please help me... Thank You...
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Do you want to catch the evnt only when the tecttbox is focused or anywhere on the form?

    Use the keyPreview property and then use the keydown event handler of the appropriate control to start implementing your logic

    cheers

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      Make the button the ACCEPTBUTTON of the form and set the KEY PREVIEW Property to TRUE.

      Comment

      Working...