methods for text box

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.
 
G

Guest

check out the "KeyPress", "KeyDown", and "KeyUp" events of the text
box....then look at the e.KeyCode property. hope this helps
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top