private void loginBtn_Click(object sender, System.EventArgs e) { string username = textUsername.Text; string password = textPassword.Text; try { ctrl.login(username, password); DashboardWindow dashWin = new DashboardWindow(ctrl, ctrl.getCurrentUser()); dashWin.Show(); this.Hide(); } catch (Exception ex) { Console.WriteLine(ex.Message); MessageBox.Show(this, "Login Error " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }