private void Registernow_Click(object sender, EventArgs e) { string username = textBox1.Text, password = textBox2.Text, designaion; if (Doctor.Checked == true) { designaion = "Doctor"; } else if (Pharmacist.Checked == true) { designaion = "Pharmacist"; } else { designaion = "Receptionist"; } if (username == "" || password == "") { MessageBox.Show("All Fields Are Required"); } else if (password.Length < 6) { MessageBox.Show("Password legth must be greater than 6"); } else if (Char.IsDigit(username[0])) { MessageBox.Show("Username can't start with Digit"); } else { UserAuthentication user = new UserAuthentication(username, password, designaion); string s = user.Register(); MessageBox.Show(s); textBox1.Text = ""; textBox2.Text = ""; } }