// Raise the Overdrawn event. protected virtual void OnOverdrawn(OverdrawnEventArgs args) { if (Overdrawn != null) { Overdrawn(this, args); } }
// The event handler with event args. private void SavingsOverdrawnHandler(object sender, OverdrawnEventArgs args) { string message = "The savings account is overdrawn." + Environment.NewLine + "Current Balance: " + args.CurrentBalance.ToString("C") + Environment.NewLine + "Debit Amount: " + args.DebitAmount.ToString("C"); MessageBox.Show(message); }
// The event handler with event args. private void OverdraftOverdrawnHandler(object sender, OverdrawnEventArgs args) { // Get the overdraft account. OverdraftAccount account = sender as OverdraftAccount; string message = "The account is overdrawn." + Environment.NewLine + "Current Balance: " + account.Balance.ToString("C") + Environment.NewLine + "Savings Balance: " + account.SavingsAccount.Balance.ToString("C") + Environment.NewLine + "Debit Amount: " + args.DebitAmount.ToString("C"); MessageBox.Show(message); }
// Raise the Overdrawn event. protected virtual void OnOverdrawn(OverdrawnEventArgs args) { if (Overdrawn != null) Overdrawn(this, args); }