Ver Mensaje Individual
  #7 (permalink)  
Antiguo 29/09/2009, 09:10
Avatar de pkj
pkj
 
Fecha de Ingreso: julio-2006
Ubicación: Órbita sincrónica
Mensajes: 899
Antigüedad: 17 años, 9 meses
Puntos: 29
Respuesta: Ayuda con login y matrices

Creo que algo así tendría que funcionar. No lo he probado.


Código :
Ver original
  1. For i = 1 To 5 Step 1
  2.             If Intento = 3 Then
  3.                 MsgBox("Error.")
  4.                 Exit For
  5.             Else
  6.                 If BoxUsuario.Text = Matriz1(i) Then
  7.                     If BoxContrasena.Text = Matriz2(i) Then
  8.                         MsgBox("Exito.")
  9.                         Intento = 0
  10.                         Exit For
  11.                     Else
  12.                         MsgBox("Contraseña incorrecta.")
  13.                         Intento = Intento + 1
  14.                         Exit For
  15.                     End If
  16.                 End If
  17.             End If
  18. Next i
  19. If i > 5 Then
  20.                     MsgBox("Usuario incorrecto.")
  21.                     Intento = Intento + 1
  22. End If

Como es tu código lo entenderás mejor y podrás repararlo si hay un fallo.

También te recomiendo usar UBound para saber el tamaño de la matriz, en lugar de usar números fijos como el 5.

Saludos

Última edición por pkj; 29/09/2009 a las 09:21