private void Iniciarsesionbutton_Click(object sender, EventArgs e) { if (EmailtextBox.Text == "user" && PasswordtextBox.Text == "1234") { MainForm mnf = new MainForm(); mnf.Show(); } else { if (UsuariosBLL.ExisteUsuario(EmailtextBox.Text, PasswordtextBox.Text)) { MainForm mnf = new MainForm(); mnf.Show(); } else { ErroreserrorProvider.SetError(EmailtextBox, "El email o clave es incorrecto"); ErroreserrorProvider.SetError(PasswordtextBox, "El email o clave es incorrecto"); PasswordtextBox.Clear(); } } EmailtextBox.Clear(); PasswordtextBox.Clear(); }
private void PasswordtextBox_TextChanged(object sender, EventArgs e) { try { Convert.ToString(PasswordtextBox.Text); } catch (Exception) { if (PasswordtextBox.TextLength > 0) { MessageBox.Show("Eingabe kann nicht verarbeitet werden"); } PasswordtextBox.Clear(); } }
private bool IsFormValidate() { if (UserNametextBox.Text.Trim() == "") { MessageBox.Show("User Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); UserNametextBox.Clear(); UserNametextBox.Focus(); return(false); } if (PasswordtextBox.Text.Trim() == "") { MessageBox.Show("Password is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); PasswordtextBox.Clear(); PasswordtextBox.Focus(); return(false); } return(true); }