On Pressing Enter key

mmb

Active member
Joined
Aug 1, 2004
Messages
42
Programming Experience
1-3
I want On Pressing ENTER key in a Textbox1 , Button1 get Press.

pls Help
 
VB.NET:
 'set the keypreview to true
 'in the keypress event of the textbox
 if e.keycode = keys.enter then
    button1.performclick
 end if
 
actually i'd put it in the textbox's keyup event (in case the keypress event is programmed and doesnt allow an enter key, i do have several programs where that is the case) but yea

VB.NET:
private sub textbox_keyup (blah...blah) handles textbox.keyup
 if e.keycode = keys.enter then button1.performclick
 end sub
 
Back
Top