Home All Groups Group Topic Archive Search About
Author
11 May 2007 11:43 AM
AVL
hi,
i've a textbox on my form
whenever user presses ENter key, i want to capture the entire text...
how can i acheive it

Author
11 May 2007 3:57 PM
Peter Duniho
On Fri, 11 May 2007 04:43:01 -0700, AVL <A**@discussions.microsoft.com> 
wrote:

> i've a textbox on my form
> whenever user presses ENter key, i want to capture the entire text...
> how can i acheive it

If your textbox has the AcceptReturn property set to false (the default), 
and you have a button on the form set to be the default action button for 
the form, then you can just hook an event handler to that button.  In the 
event handler, just get the Text property from your textbox control.

If you don't have a button set as the default action, then you can still 
do it, but you instead need to handle the KeyDown or KeyPress event for 
the form (if you want it to always happen) or the control (if you want it 
to happen only when that control has focus), and get the Text property 
when you get the event with the Enter button as the key that was pushed.

Pete

AddThis Social Bookmark Button