Connecting Tech Pros Worldwide Help | Site Map

tab and enter key

Newbie
 
Join Date: Oct 2009
Posts: 22
#1: 2 Weeks Ago
hi,
i wanna call a function when tab key is pressed and another function on pressing enter key.
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Tab)
MessageBox.Show("TAB");

}
bt its nt workin.
Newbie
 
Join Date: Nov 2009
Posts: 1
#2: 2 Weeks Ago

re: tab and enter key


hi,

I just tried out the snippet.but the required functionality can be achieved using both the text box's "KeyUp" and "KeyDown" event.

KeyUpEvent - Handle the Tab key.
KeyDownEvent - Handle the Enter key.

May not be the best of solutions...but works.
Reply