private void depositButton_Click(object sender, EventArgs e) { AmountEntryForm form = new AmountEntryForm(AmountDialogType.Deposit); DialogResult result = form.ShowDialog(this); if (result == DialogResult.OK) { exceptionTextBox.Text = String.Empty; try { bankAccount.Deposit(form.Amount); } catch (Exception ex) { exceptionTextBox.Text = ex.Message; } } }
private void withdrawButton_Click(object sender, EventArgs e) { AmountEntryForm form = new AmountEntryForm(AmountDialogType.Withdraw); DialogResult result = form.ShowDialog(this); if (result == DialogResult.OK) { exceptionTextBox.Text = String.Empty; try { bankAccount.Withdraw(form.Amount); } catch (Exception ex) { exceptionTextBox.Text = ex.Message; } } }