private void quizBtn_Click(object sender, EventArgs e) { string folderLocal = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string folderProgram = System.IO.Path.Combine(folderLocal, "Digital Flash Cards"); //check if the program's directory contains sub-folders (flash card subjects) if (System.IO.Directory.GetDirectories(folderProgram).Length == 0) { MessageBox.Show("Enter information first by clicking the 'Enter Info' button.", "Flash Cards Not Found", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (System.IO.Directory.GetDirectories(folderProgram).Length != 0) { //create an object for the quizForm quizForm quiz = new quizForm(); //create a form closed event to dispose of the quizForm form correctly quiz.FormClosed += new FormClosedEventHandler(quiz_FormClosed); this.Hide(); quiz.Show(); } }
private void quiz_FormClosed(object sender, FormClosedEventArgs e) { quizForm quiz = new quizForm(); quiz.Dispose(); this.Show(); }