// Display Add/Edit form for adding a course. Added course will // arrive via custom event to registered handler. private void btnAdd_Click(object sender, EventArgs e) { Hide(); var dlg = new frmAddEdit(); dlg.CourseAddedEdited += CourseAdded; dlg.ShowDialog(this); Show(); }
// Display Add/Edit form for editing a selected course. The edited // course will arrive via a custom event to the registered handler. private void btnEdit_Click(object sender, EventArgs e) { Hide(); var dlg = new frmAddEdit(); dlg.CourseAddedEdited += CourseEdited; dlg.CourseName = lstPending.SelectedIndex != -1 ? lstPending.SelectedItem.ToString() : lstComplete.SelectedItem.ToString(); dlg.ShowDialog(this); Show(); DisableButtons(); }