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