private void btnAddStudent_Click(object sender, EventArgs e) { // Add Student Button on Add Contact Page // declaring variables name = txtSName.Text.ToUpper(); phone = txtSPhone.Text; email = txtSEmail.Text; status = ""; if (rdoPostgrad.Checked) { status = "POSTRGAD"; } else if (rdoUndergrad.Checked) { status = "UNDERGAD"; } id = txtSID.Text; // check phone number entered correctly checkPhone = NumberCheck(phone); NumberPrint(checkPhone, "Phone"); // check emails entered correctly checkEmails = EmailCheck(email); // if errors detected print out error EmailPrint(checkEmails); // check student id entered correctly checkNumbers = NumberCheck(id); NumberPrint(checkNumbers, "StudentID"); // validation check checkFields = (InputCheck(name, phone, email, status, id)); if (checkFields == 0 && checkEmails == 0 && checkPhone == 0 && checkNumbers == 0) { // use AddStudent method in Heavylifting class hl.AddStudent(name, phone, email, status, id); // clear entry point boxes txtSName.Clear(); txtSPhone.Clear(); txtSEmail.Clear(); rdoPostgrad.Checked = false; rdoUndergrad.Checked = false; txtSID.Clear(); MessageBox.Show("Student Contact was added sucessfully."); } else if (checkFields == 1) { MessageBox.Show("Whoops, you forgot to enter 1 field. Please enter all the infomation for the Student Contact."); } else if (checkFields > 1) { MessageBox.Show(string.Format("Whoops, you forgot to enter {0} fields. Please enter all the infomation for the Student Contact.", checkFields)); } }