I am using the following code for goto next and previous controls in windows form
if (e.KeyCode == Keys.Enter)//Next
{
this.SelectNextControl(this.ActiveControl, true, true, true, true);
}
if (e.KeyCode == Keys.Back)//Previous
{
this.SelectNextControl(this.ActiveControl, false, true, true, true);
}
The problem in
if (e.KeyCode == Keys.Back)
If current control is a TextBox
and the user tries to type and delete one word using backspace, that time this will work and set the focus to the next control.
How to prevent this event when textbox have some values?
And it should work for ComboBox
and other controls