private void Insert_Click(object sender, EventArgs e) { using (ProvideIEF frm = new ProvideIEF(null, db)) { if (frm.ShowDialog() == DialogResult.OK) { provideBindingSource.DataSource = db.Provide.ToList(); } } }
private void Edit_Click(object sender, EventArgs e) { if (provideBindingSource.Current == null) { return; } using (ProvideIEF frm = new ProvideIEF(provideBindingSource.Current as Provide, db)) { if (frm.ShowDialog() == DialogResult.OK) { provideBindingSource.DataSource = db.Provide.ToList(); } else { db = new my_db_for_db_2Entities(); provideBindingSource.DataSource = db.Provide.ToList(); } } }