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
On Error GoTo denei
pero nose como arreglar este error.
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"