Ejemplo n.º 1
0
        private void btnEditUser_Click(object sender, EventArgs e)
        {
            if (bsUsers.Current == null)
            {
                return;
            }

            DataRowView editUser = (DataRowView)bsUsers.Current;

            frmUser      editForm = new frmUser(editUser);
            DialogResult result   = editForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                bsUsers.EndEdit();
                usersTableAdapter.Update(dsPhoneBook);
            }
            else
            {
                bsUsers.CancelEdit();
            }
        }
Ejemplo n.º 2
0
        private void btnNewUser_Click(object sender, EventArgs e)
        {
            DataRowView newUser = (DataRowView)bsUsers.AddNew();

            frmUser      frmEditUsers = new frmUser(newUser);
            DialogResult result       = frmEditUsers.ShowDialog();

            if (result == DialogResult.OK)
            {
                bsUsers.EndEdit();
                usersTableAdapter.Update(dsPhoneBook);

                dsPhoneBook.Users.Clear();
                usersTableAdapter.Fill(dsPhoneBook.Users);
            }

            else
            {
                bsUsers.CancelEdit();
            }

            AdjustControlsAvailability();
        }