Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

[Q] Capture 'Enter' keys, send 'Tab'

Status
Not open for further replies.

johnsun1976

Programmer
Jan 28, 2002
34
CA
Hi. I'm wondering how I can capture the Enter key and send a tab to go to the next control?
Thanks
John
 
I am wondering the same. Can anyone out there advise?
 
To trap Enter keys, you can handle this through KeyDown event. To move to the next available control, call SelectNextControl() method.

Something like...
Code:
void urctrl_KeyDown(object sender, KeyEventArgs e)
{
    if(e.KeyCode == Keys.Enter)
      urctrl.SelectNextControl(urctrl, true, true, true, true);
}
Check out documentation of KeyDown, KeyPress, KeyUp and SelectNextControl().

Hope this helps!
[peace]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top