private void NewConsumerBtn_Click(object sender, EventArgs e) { using (CustomersIEF frm = new CustomersIEF(null, db)) { if (frm.ShowDialog() == DialogResult.OK) { customersBindingSource.DataSource = db.Customers.ToList(); } } }
private void Edit_Click(object sender, EventArgs e) { if (customersBindingSource.Current == null) { return; } using (CustomersIEF frm = new CustomersIEF(customersBindingSource.Current as Customers, db)) { if (frm.ShowDialog() == DialogResult.OK) { customersBindingSource.DataSource = db.Customers.ToList(); } else { db = new my_db_for_db_2Entities(); customersBindingSource.DataSource = db.Customers.ToList(); } } }