private void btnLogin_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtUserName.Text) || string.IsNullOrWhiteSpace(txtPassword.Text)) return; try { IUserService userService = new UserService(); bool isUserAuthorized = false; // userService.ValidateUser(txtUserName.Text, txtPassword.Text); if (!isUserAuthorized) { lblError.Text = "Invalid user name or password. Please try again."; return; } MainForm mainForm = new MainForm(); mainForm.Show(); //this.Close(); this.Hide(); } catch (Exception) { throw; } }
private void button1_Click(object sender, EventArgs e) { MainForm main = new MainForm(); main.Show(); }