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