I have set the "ENTER" key as a "TAB" key in windows form.
following is the code
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
KeyEventArgs e = new KeyEventArgs(keyData);
if (e.KeyCode == Keys.Enter)
{
SendKeys.Send("{TAB}");
}
if (e.KeyCode == Keys.Escape)
{
this.Close();
}
return base.ProcessCmdKey(ref msg, keyData);
}
its working perfectly with all controls but when I press ENTER on any combobox then it takes two tab indexes. eg.
- textbox1
- combobox
- textbox2
- textbox3
- textbox4
when i press ENTER to leave combobox then the cursor(FOCUS) is directly comes to the textbox 3 i want that focus to the next control of combobox , i.e, textbox 2
please help me
thanks in advance..!