}//end //add file code below private void AddModuleButton_Click(object sender, EventArgs e) { //clear all text from text boxes fileContentsTextBox.Clear(); StageTextBox.Clear(); titleTexBox.Clear(); ModuleTitlelistView1.Clear(); InClassTextBox.Clear(); //need to show the two text box at the top of the form if (fileContentsTextBox.Text.Length == 0) { MessageBox.Show("Please enter text!"); } }//end add module button
}//end add module button //delete module private void DeleteButton_Click(object sender, EventArgs e) { //give the user an option of not deleting string MessageBoxContent = "Do you really want to delete the file!"; //title on the message box string MessageBoxTitle = "WARNING"; DialogResult dialogResult = MessageBox.Show(MessageBoxContent, MessageBoxTitle, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) {//start if File.Exists(fileName); { try { //start try File.Delete(fileName); // need a try and catch here incase a user has no file selected //clear all text from text boxes fileContentsTextBox.Clear(); StageTextBox.Clear(); titleTexBox.Clear(); ModuleTitlelistView1.Clear(); InClassTextBox.Clear(); }//end try catch (Exception ex) {//start catch MessageBox.Show("No File"); } //end catch } } //end if //if NO then close message box else if (dialogResult == DialogResult.No) { //close message box and do nothing } }//end deletButton