methods for text box

  • Thread starter Thread starter scenic_man
  • Start date Start date
S

scenic_man

I'm playing around with some sample code in VB Express.
I have a form with a text box and a button.
Naturally, the button causes some code to process what's in the text box.

Now I would like to have it so that when the text box has focus
(e.g. I've clicked the mouse while over it),
and I hit the <ENTER> key, it also processes what's in the text box.

I have figured out by using IntelliSense that there is a "Leave" event,
and by actual use that this event is triggered by hitting the <TAB> key.

However, IntelliSense does not seem to list an event
that corresponds to hitting the <ENTER> key.
 
check out the "KeyPress", "KeyDown", and "KeyUp" events of the text
box....then look at the e.KeyCode property. hope this helps
 
scenic_man,

For this example you could set the form's AcceptButton property to the
button that does the textbox processing. Hitting enter in the textbox will
then cause that button's click event to fire.

Kerry Moorman
 
Back
Top