private void btn_login_Click(object sender, EventArgs e) { string name = txt_name.Text; string password = txt_password.Text; if (!(name == string.Empty) && !(password == string.Empty)) { bool result = _login.ValidateUser(name, password); if (result) { MessageBox.Show("Login Sucessful", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); MainForm main = new MainForm(name); main.ShowDialog(); Close(); } else { MessageBox.Show("Fail!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Plz enter password and username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btn_login_Click(object sender, EventArgs e) { string name = txt_name.Text; string pwd = txt_password.Text; if (_login.ValidateUser(name, pwd)) { MessageBox.Show("Welcome Login Sucessful", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); _currentuser = name; MainForm.SetName(name, _main); Hide(); } }