private void FrmAdditionalDesc_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { BtnOK.PerformClick(); } else if (e.KeyCode == Keys.Escape) { if (string.IsNullOrEmpty(TxtAdditionalDesc.Text.Trim().ToString())) { _AdditionalDesc = "<SPACE>"; } else { _AdditionalDesc = TxtAdditionalDesc.Text.Trim().ToString(); } this.Close(); } }
private void FrmTerm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && this.ActiveControl != Grid) { SendKeys.Send("{Tab}"); } else if (e.KeyCode == Keys.Escape) { if (TxtGridRatePercent.Visible == true) { GridControlMode(false); TxtGridRatePercent.Enabled = false; TxtGridRatePercent.Visible = false; TxtGridAmount.Enabled = false; TxtGridAmount.Visible = false; Grid.Focus(); } else { BtnOK.PerformClick(); } } }