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