private void btnAdd_Click(object sender, EventArgs e) { using (formAddEditContact formAddEditContact = new formAddEditContact(null)) { if (formAddEditContact.ShowDialog() == DialogResult.OK) { contactBindingSource.DataSource = contactEntities.Contacts.ToList(); } } }
private void btnEdit_Click(object sender, EventArgs e) { if (contactBindingSource.Current == null) { return; } using (formAddEditContact formAddEditContact = new formAddEditContact(contactBindingSource.Current as Contact)) { if (formAddEditContact.ShowDialog() == DialogResult.OK) { contactBindingSource.DataSource = contactEntities.Contacts.ToList(); } } }