private void OpenAddForm(int id) { selectedId = id; Form addForm = this.ParentForm.OwnedForms.FirstOrDefault(a => a.Name == "AddCustomerForm"); if (addForm == null) { AddCustomerForm form = new AddCustomerForm(); form.CustomerId = id; form.CustomerUpdated += new CustomerUpdatedEventHandler(form_CustomerUpdated); form.Owner = this.ParentForm; form.Show(); } else { AddCustomerForm openedForm = (AddCustomerForm)addForm; openedForm.CustomerId = id; openedForm.LoadCustomerDetails(); openedForm.Focus(); } }
private void Button5_Click(object sender, EventArgs e) { AddCustomerForm addCustomerForm = new AddCustomerForm(); addCustomerForm.Show(); }