private void logIn_Click(object sender, EventArgs e) { AdminLog s = new AdminLog(); s.UserName = userNameTextBox.Text; s.Password = pswdTextBox.Text; //Connection cn = new Connection(); DataTable dt = new DataTable(); dt = s.getAdminData(s); if (dt.Rows.Count > 0) { this.Hide(); Administrators admin = new Administrators(); admin.Show(); } else { MessageBox.Show("Invalid userName and Password"); } }