private void Year_KeyDown(object sender, KeyEventArgs e) { try { //this.Parent.Parent.Parent.Parent.GetNextControl(this, true).Focus(); //if (e.KeyCode == Keys.Enter) // SendKeys.Send("{TAB}"); if (e.KeyCode == Keys.Enter) { if (NextControl != null && NextControl.Visible && NextControl.Enabled) { NextControl.Focus(); } else if (NextControl != null && (!NextControl.Visible | !NextControl.Enabled)) { SendKeys.Send("{TAB}"); } } else { CheckKeyUpDown(e, Year, 2200); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected override void OnKeyDown(KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (NextControl != null) { NextControl.Focus(); } base.OnKeyDown(e); } }
void Atiran2DateControl_Enter(object sender, EventArgs e) { if (_dateCriterionFromServer) { if (NextControl != null && NextControl.Visible && NextControl.Enabled) { NextControl.Focus(); } else if (NextControl != null && (!NextControl.Visible | !NextControl.Enabled)) { SendKeys.Send("{TAB}"); } this.Enabled = false; } else { Day.Focus(); } }