private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text)) { MessageBox.Show("Error: Invalid User. Please check your user credentials", "User not found", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } cf.sqlconn_client = SQLClient; cf.sqlconn_server = SQLServer; if (!cf.isUserValid(textBox1.Text, textBox2.Text, BranchCode, ref ActiveRole)) { MessageBox.Show("Error: Invalid User. Please check your user credentials", "User not found", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ActiveUser = textBox1.Text; this.Close(); }