private void refreshListButton_Click(object sender, EventArgs e) { // switch to view all students Form if (viewStudentForm == null) { if (mainForm == null) { mainForm = new MainForm(); mainForm.Show(); } else { mainForm.Activate(); } viewStudentForm = new ViewStudentForm(); viewStudentForm.MdiParent = mainForm; viewStudentForm.FormClosed += delegate(object o, FormClosedEventArgs args) { viewStudentForm = null; }; viewStudentForm.Show(); } else { viewStudentForm.Activate(); viewStudentForm.PopulateListView(); } }
private void viewAllToolStripMenuItem2_Click(object sender, EventArgs e) { // view all students if (viewStudentForm == null) { viewStudentForm = new ViewStudentForm(); viewStudentForm.MdiParent = this; viewStudentForm.FormClosed += delegate(object o, FormClosedEventArgs args) { viewStudentForm = null; }; viewStudentForm.Show(); } else { viewStudentForm.Activate(); viewStudentForm.PopulateListView(); } }