Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C# act on enter key in a TextBox

0 views
Skip to first unread message

ker...@gmail.com

unread,
May 12, 2008, 8:08:35 AM5/12/08
to
Hi!

I have a Textbox and would like to commit a search on the text
entered in it if someone wrote something in and than pressed the Enter
key.

What is the best way to do that?
What event should I use?

Thank you in advance,
Keren

DSK Chakravarthy

unread,
May 12, 2008, 8:12:44 AM5/12/08
to
For a windows application, it is recommended to write a keydown event.
For a web application, it is recommended to implement the same with either
validate or lost focus

HTH


<ker...@gmail.com> wrote in message
news:a404e158-3a68-4627...@y38g2000hsy.googlegroups.com...

Diego Armando Maradona

unread,
May 12, 2008, 8:16:08 AM5/12/08
to
in the textbox "keydown" event,

if (e.keycode == keys.return)
{
doSearch();
}


<ker...@gmail.com> wrote in message
news:a404e158-3a68-4627...@y38g2000hsy.googlegroups.com...

Ignacio Machin ( .NET/ C# MVP )

unread,
May 12, 2008, 11:48:27 AM5/12/08
to

Take a look at Form.ProcessCmdKey

0 new messages