Beispiel #1
0
        private void editAccountButton_Click(object sender, EventArgs e)
        {
            if (accountBindingSource.Count < 1)
            {
                addAccountButton_Click(sender, e);
                return;
            }
            var accountID   = (int)((DataRowView)accountBindingSource.Current).Row["AccountID"];
            var accountForm = new AccountForm(accountID);

            accountForm.ShowDialog();

            accountTableAdapter.Fill(databaseDataSet.Account);
            var position = accountBindingSource.Find("AccountID", accountID);

            accountBindingSource.Position = position;
            accountBindingSource.ResetCurrentItem();
        }
Beispiel #2
0
        private void addAccountButton_Click(object sender, EventArgs e)
        {
            var newAccount = databaseDataSet.Account.NewAccountRow();

            newAccount.Name = "New Account";
            newAccount.Type = AccountType.Cash;
            databaseDataSet.Account.Rows.Add(newAccount);
            accountTableAdapter.Update(databaseDataSet.Account);
            var accountID = newAccount.AccountID;
            var position  = accountBindingSource.Find("AccountID", accountID);

            accountBindingSource.Position = position;

            var accountForm = new AccountForm(accountID);

            accountForm.ShowDialog();

            accountTableAdapter.Fill(databaseDataSet.Account);
            accountBindingSource.Position = position;
            accountBindingSource.ResetCurrentItem();
        }