private async void tbEdit_Click(object sender, EventArgs e) { Programme obj = programmeBindingSource.Current as Programme; if (obj != null) { using (frmProgrammeInfo frm = new frmProgrammeInfo(obj)) { if (frm.ShowDialog() == DialogResult.OK) { try { programmeBindingSource.EndEdit(); await db.SaveChangesAsync(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
public frmProgrammeInfo(Programme obj) { InitializeComponent(); programmeBindingSource.DataSource = obj; }