private void btnAdd_Click(object sender, EventArgs e) { using (frmAddEditContact frm = new frmAddEditContact(null)) { if (frm.ShowDialog() == DialogResult.OK) contactsBindingSource.DataSource = db.Contacts.ToList(); } }
private void btnEdit_Click(object sender, EventArgs e) { if (contactsBindingSource.Current == null) return; using (frmAddEditContact frm = new frmAddEditContact(contactsBindingSource.Current as Contacts)) { if (frm.ShowDialog() == DialogResult.OK) contactsBindingSource.DataSource = db.Contacts.ToList(); } }