Description : In this post go to next control using Enter Key in c# windows application
- Add 2 Textbox in winform
- Generate KeyDown event of both textbox control
- Add Below code in both keydown event
private void textbox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
textbox2.Focus();
}
private void textbox2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
textbox1.Focus();
}
Note : if focus in textbox 1 than press enter and change focus in textbox2 if again press enter than focus set in textbox1
- Add 2 Textbox in winform
- Generate KeyDown event of both textbox control
- Add Below code in both keydown event
private void textbox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
textbox2.Focus();
}
private void textbox2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
textbox1.Focus();
}
Note : if focus in textbox 1 than press enter and change focus in textbox2 if again press enter than focus set in textbox1
No comments:
Post a Comment