private void AccountNumber_Leave(object sender, EventArgs e) { if (AccountNumber.Text == "1234") { info.Text = "Please complete the Customer A/c # entry correctly"; AccountNumber.Focus( ); return; } if (dirty) { return; } if (AccountNumber.Text == "") { MessageBox.Show("You MUST enter a valid Cusotmer A/c #, Please try again... ", "Customer deletion system"); AccountNumber.Focus( ); return; } if (Bank == null) { Bank = DataArray.ArrayGetBank(Convert.ToInt32(AccountNumber.Text)); if (Bank == null) { info.Text = "The Customer # " + AccountNumber.Text + " cannot be found ?. Please try again... "; MessageBox.Show("The Bank account # " + AccountNumber.Text + " for this Customer cannot be found ?. Please try a different value... ", "Customer deletion system"); AccountNumber.Focus( ); return; } bankno.Text = Bank.BankAccountNumber.ToString( ); } DeleteButton.Enabled = true; //Customer C = new Customer ( ); Cust = DataArray.ArrayGetCust(Convert.ToInt32(Bank.CustAccountNumber.ToString( ))); if (Cust == null) { MessageBox.Show("Cannot identify the Customer A/c # , Please try again... ", "Customer deletion system"); return; } else { LastName.Text = Cust.LastName; FirstName.Text = Cust.FirstName; info.Text = "Customer A/C found ! - Click the Delete button to remove this account..."; DeleteButton.Focus( ); MessageBox.Show("Customer A/c # Identified, press the Delete button to remove it... ", "Customer deletion system"); } }
private void MainForm_KeyDown(object sender, KeyEventArgs e) { if (BpmMultiplierUpDown.Focused || NewBpmTextBox.Focused) { return; } if (e.KeyCode == Keys.D1) { ResetButton_Click(null, null); ResetButton.Focus(); } if (e.KeyCode == Keys.D2) { DeleteButton_Click(null, null); DeleteButton.Focus(); } if (e.KeyCode == Keys.D3 && GenerateMapButton.Enabled) { GenerateMapButton_Click(null, null); GenerateMapButton.Focus(); } }