private void button1_Click(object sender, EventArgs e) { if (sbl.IsExistCSStudent(textBox1.Text) || sbl.IsExistEEEStudent(textBox1.Text) || sbl.IsExistBBAStudent(textBox1.Text)) { MessageBox.Show("Student with same Student ID already exist.\nPlease use another Student ID."); } else if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox8.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox7.Text == "" || textBox6.Text == "" || textBox9.Text == "" || textBox13.Text == "" || textBox14.Text == "" || textBox15.Text == "" || comboBox1.SelectedIndex == 0 || textBox12.Text == "" || textBox11.Text == "" || textBox16.Text == "" || textBox17.Text == "" || pictureBox1.Image == null) { MessageBox.Show("Please fill all the information correctly."); } else if (textBox1.Text.Length != 6) { MessageBox.Show("Please use 6 character for a User Name."); } else { string bloodGroup = comboBox1.Items[comboBox1.SelectedIndex].ToString(); string gender, maritalStatus; if (radioButton1.Checked == true) { gender = "Male"; } else { gender = "Female"; } if (checkBox1.Checked == true) { maritalStatus = "Married"; } else { maritalStatus = "Unmarried"; } sbl.AddStudent(textBox1.Text, textBox2.Text, textBox3.Text, textBox8.Text, textBox4.Text, textBox5.Text, textBox7.Text, textBox6.Text, textBox9.Text, textBox13.Text, textBox14.Text, textBox15.Text, gender, textBox12.Text, textBox11.Text, maritalStatus, bloodGroup, textBox16.Text, textBox17.Text, pictureBox1.Image, department); this.Hide(); StudentsList fl = new StudentsList(loginUserName, department); fl.Show(); MessageBox.Show("Student added successfully."); } }