private void button2_Click(object sender, EventArgs e) { flag = true; if ((txtEmpNum.Text.Equals("")) || (txtPass.Text.Equals("")) || (cmbClinickNum.SelectedValue == null)) { MessageBox.Show("Invalid Login Details"); } else { if (database.EmployeelogIn(txtEmpNum.Text, txtPass.Text, cmbClinickNum.SelectedValue.ToString()) == true) { if (txtEmpNum.Text.Substring(3, 1).Equals("S")) { SecretariesForm SecForm = new SecretariesForm(); SecForm.Show(); this.Close(); } else if (txtEmpNum.Text.Substring(3, 1).Equals("V")) { ManagerForm manager = new ManagerForm(); manager.Show(); this.Close(); } } else { MessageBox.Show("Invalid login details"); } } }