public addNewCustomer(Customerss obj)
        {
            InitializeComponent();
            bindingSourceCustomer.DataSource = obj;

            if (checkGender.CheckState == CheckState.Checked)
            {
                checkGender.Text = "Male";
            }
            else if (checkGender.CheckState == CheckState.Unchecked)
            {
                checkGender.Text = "Female";
            }
            else
            {
                checkGender.Text = "???";
            }
        }
Beispiel #2
0
        private async void mtEdit_Click(object sender, EventArgs e)
        {
            Customerss obj = customerBindingSource.Current as Customerss;

            if (obj != null)
            {
                using (addNewCustomer add = new addNewCustomer(obj))
                {
                    if (add.ShowDialog() == DialogResult.OK)
                    {
                        try
                        {
                            customerBindingSource.EndEdit();
                            await db.SaveChangesAsync();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
            }
        }