예제 #1
0
 public Form2(ref Account account)
 {
     InitializeComponent();
     this.account = account;
     this.Visible = true;
     child = new Form3(ref account, this);
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
 public Form3(ref Account account, Form2 parent)
 {
     InitializeComponent();
     this.account = account;
     this.parent = parent;
 }