private void bntLogin_Click(object sender, EventArgs e) { string u = txtUser.Text; string p = txtPass.Text; DataProcess dt = new DataProcess(); Staff temp = dt.CheckLogin(u, p); if (temp != null) { this.Account = temp; MessageBox.Show(this, "Logged in successfully", "Result", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); } else { MessageBox.Show(this, "Login failed", "Result", MessageBoxButtons.OK, MessageBoxIcon.Error); } }