private void buttonAccept_Click(object sender, EventArgs e) { double output; if (double.TryParse(textBoxAmount.Text, out output) == false) { MessageBox.Show("Please enter a valid dollar amount.", "Transaction", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } switch (buttonAccept.Text) { case "Deposit": { balance += output; break; } case "Withdraw": { balance -= output; break; } case "Transfer": { MessageBox.Show("Work in progress."); break; } } wind.SetBalance(balance); }