private void startSurvey_Button_Click(object sender, EventArgs e) { int currSemester; // check to see if all fields are filled bool allFilled = (courseCode_textBox.Text.Length > 0) && (currSemester_textBox.Text.Length > 0) && (profName_textBox.Text.Length > 0); bool validCurrSem = Int32.TryParse(currSemester_textBox.Text, out currSemester); // first check if all boxes are filled out and then check if the current semester is a valid number if (allFilled) { if (validCurrSem) { Question1_Form q1_form = new Question1_Form(this); courseCodeText = courseCode_textBox.Text; currSemText_number = currSemester; profNameText = profName_textBox.Text; q1_form.Show(); } else { MessageBox.Show("That is not a valid semester"); } } else { MessageBox.Show("Please fill out all fields"); } }
private void getCurrentInfo() { mainForm main = new mainForm(); Question1_Form q1Form = new Question1_Form(referenceMain); Question2_Form q2Form = new Question2_Form(referenceMain); Question3_Form q3Form = new Question3_Form(referenceMain); courseCode = main.courseCode; currentSemester = main.currentSemester.ToString(); profName = main.profName; q1_answer = q1Form.Q1_Answer; q2_answer = q2Form.Q2_Answer; q3_answer = q3Form.Q3_Answer; }