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