private void button1_Click(object sender, EventArgs e) { localhost.Service1 ser = new localhost.Service1(); bool isalreadyexist; bool isalreadyexistpassed; ser.IsTeacherAlreadyExists(txtusername.Text, txtpassword.Text, out isalreadyexist, out isalreadyexistpassed); if (isalreadyexist) { MessageBox.Show("Teacher already exists"); txtemail.Text = ""; txtusername.Text = ""; txtpassword.Text = ""; txtconfirmpassword.Text = ""; txtsecretcode.Text = ""; } else { if (txtpassword.Text == txtconfirmpassword.Text && txtpassword.Text.Length >= 6) { if (txtsecretcode.Text.Length >= 4 && txtsecretcode.Text.Length <= 7) { ser.RegisterTeacher(txtusername.Text, txtpassword.Text, txtsecretcode.Text); MessageBox.Show("Teacher Has Been Registered"); txtemail.Text = ""; txtusername.Text = ""; txtpassword.Text = ""; txtconfirmpassword.Text = ""; txtsecretcode.Text = ""; } else { MessageBox.Show("Invalid Secret code "); } } else { MessageBox.Show("Invalid Password Length or mismatch password"); } } }