示例#1
0
        private async void btnEditCompany_Click(object sender, EventArgs e)
        {
            CompanyTable obj = companyTableBindingSource.Current as CompanyTable;

            if (obj != null)
            {
                using (frmAddEditCompany frm = new frmAddEditCompany(obj))
                {
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            companyTableBindingSource.EndEdit();
                            await db.SaveChangesAsync();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }
示例#2
0
 public frmAddEditCompany(CompanyTable obj)
 {
     InitializeComponent();
     bindingSourceCompany.DataSource = obj;
 }