public Form2(ref Account account) { InitializeComponent(); this.account = account; this.Visible = true; child = new Form3(ref account, this); }
private void button3_Click(object sender, EventArgs e) { if (fieldsVisible) { try { Account[] tmpAccounts = Program.accounts; Account[] newAccounts = new Account[tmpAccounts.Length + 1]; for(int i = 0; i < tmpAccounts.Length; i++) { newAccounts[i] = tmpAccounts[i]; } newAccounts[newAccounts.Length - 1] = new Account( Convert.ToInt32(balanceTextBox.Text), Convert.ToInt32(textBox2.Text), Convert.ToInt32(textBox1.Text), nameTextBox.Text ); Program.accounts = newAccounts; Program.saveAccounts(); } catch (Exception ex) { Console.WriteLine("Error adding new account..."); } fieldsVisible = false; nameTextBox.Visible = false; balanceTextBox.Visible = false; } else { nameTextBox.Visible = true; balanceTextBox.Visible = true; fieldsVisible = true; } }
public Form3(ref Account account, Form2 parent) { InitializeComponent(); this.account = account; this.parent = parent; }