// When they change the account from the dropdown private void accountsComboBox_SelectedIndexChanged(object sender, EventArgs e) { this.right_usercontrol = b; // Get what they changed it to String acctNum = this.accountsComboBox.Text; List<Account> accts = this.customer.Accounts; bool has_savings = false, has_checking = false; // Used for settings savings or checking to null foreach (Account i in accts) { if (i.AccountNumber.ToString() == acctNum) { if (i is SavingsAccount) { this.SAccount = (SavingsAccount)i; has_savings = true; } else if (i is CheckingAccount) { this.CAccount = (CheckingAccount)i; has_checking = true; } } } if (!has_checking) this.CAccount = null; if (!has_savings) this.SAccount = null; this.right_usercontrol.Visible = false; this.treeView1.SelectedNode = this.treeView1.Nodes[0]; this.right_usercontrol.Visible = true; }
public SavingsAccount(SavingsAccount copy) : base(copy) { }