private void ListCourses_DoubleClick(object sender, EventArgs e) { var selectedCourse = ListCourses.SelectedItem as Course; if (selectedCourse != null) { var whiteBoardForm = new WhiteBoard(selectedCourse.Id, m_userName); this.Hide(); whiteBoardForm.ShowDialog(); this.Close(); } }