contro de errores

Iniciado por andaluz, 26 Octubre 2010, 20:49 PM

0 Miembros y 1 Visitante están viendo este tema.

andaluz

me gustaria que me ayudarais a controlar el error.

Código (vb) [Seleccionar]

On Error GoTo denei
                                               'Código posible error
                                               If Not lbl_d.Caption = lbl_dni1.Caption Then
                                                   error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                   Else
                                                       If Not lbl_d.Caption = lbl_dni2.Caption Then
                                                           error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                       Else
                                                           If Not lbl_d.Caption = lbl_dni3.Caption Then
                                                               error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                           Else
                                                               If Not lbl_d.Caption = lbl_dni4.Caption Then
                                                                   error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                                   Else
                                                                       If Not lbl_d.Caption = lbl_dni5.Caption Then
                                                                           error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                                       Else
                                                                           If Not lbl_d.Caption = lbl_dni6.Caption Then
                                                                               error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                                           Else
                                                                               If Not lbl_d.Caption = lbl_dni7.Caption Then
                                                                                   error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                                               Else
                                                                                   If Not lbl_d.Caption = lbl_dni8.Caption Then
                                                                                       error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                                                   Else
                                                                                       If Not lbl_d.Caption = lbl_dni9.Caption Then
                                                                                           error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                                                       Else
                                                                                           If Not lbl_d.Caption = lbl_dni10.Caption Then
                                                                                               error = MsgBox("DNI no registrado", vbExclamation, "Error")
                                                                                       End If
                                                                                   End If
                                                                               End If
                                                                           End If
                                                                       End If
                                                                   End If
                                                           End If
                                                       End If
                                               End If


el error creo que esta en la primera línea
Código (vb) [Seleccionar]
On Error GoTo denei pero nose como arreglar este error.

saludos

ignorantev1.1

#1
Por que no crear un array de controles?
Código (vb) [Seleccionar]

 dim i as integer
 for i=1 to 10
    if not lbl_d.caption=lbl_dni(i).caption then  goto denei
  next
denei:
  MsgBox "DNI no registrado", vbExclamation, "Error"