private void btnAdd_Click(object sender, EventArgs e) { frmAddModifyCustomer addCustomerForm = new frmAddModifyCustomer(); addCustomerForm.AddCustomer = true; DialogResult result = addCustomerForm.ShowDialog(); if (result == DialogResult.OK) { var customer = addCustomerForm.Customer; customerIDTextBox.Text = customer.CustomerID.ToString(); DisplayCustomer(customer); } }
private void btnModify_Click(object sender, EventArgs e) { if (Customer == null) { MessageBox.Show(Properties.Resources.ModifyCustomerNoCustomerFoundMessage, Properties.Resources.ModifyCustomerNoCustomerFoundCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } frmAddModifyCustomer modifyCustomerForm = new frmAddModifyCustomer(); modifyCustomerForm.AddCustomer = false; modifyCustomerForm.Customer = Customer; DialogResult result = modifyCustomerForm.ShowDialog(); if (result == DialogResult.OK) { var customer = modifyCustomerForm.Customer; DisplayCustomer(customer); } }