Requisitos de finalización
Abrió: miércoles, 30 de septiembre de 2026, 21:00
Cierre: miércoles, 30 de septiembre de 2026, 23:00
Realiza el reporte de la práctica para validar usuario y contraseña mediante el uso de control Error provider
1.- Validar cajas de texto (usuario y contraseña)
entrega: individual
formato: u2_p2_error_provider_nombre del alumno.ppt
vista diseño
vista código
video
Dim hay_error As Boolean = False
'Validando el usuario
If TextBox1.Text = "" Then
ErrorProvider1.SetError(TextBox1, "El campo no debe estar vacío")
hay_error = True
Exit Sub
Else
If IsNumeric(TextBox1.Text) Then
ErrorProvider1.SetError(TextBox1, "El campo no debe ser numérico")
hay_error = True
Exit Sub
Else
ErrorProvider1.SetError(TextBox1, "")
End If
End If
If TextBox1.Text = "invitado" Then
ErrorProvider1.SetError(TextBox1, "")
Else
ErrorProvider1.SetError(TextBox1, "Usuario incorrecto")
hay_error = True
Exit Sub
End If
'Validando contraseña
If TextBox2.Text = String.Empty Then
ErrorProvider1.SetError(TextBox2, "El campo no debe estar vacío")
hay_error = True
Exit Sub
Else
If Not IsNumeric(TextBox2.Text) Then
ErrorProvider1.SetError(TextBox2, "Introduzca un valor numérico")
Exit Sub
Else
If TextBox2.Text = "123" Then
ErrorProvider1.SetError(TextBox2, "")
Else
ErrorProvider1.SetError(TextBox2, "Constraseña incorrecta")
Exit Sub
End If
End If
End If
'validando si hay errores comprobar que los datos estén correctamente validados
If hay_error = False Then
MsgBox("Listos para guardar o enviar")
Else
MsgBox("No hacer nada")
End If
End Sub