Navegando entre páginas que hice, encontré también la validación de CBU hecha en ASP, les paso las funciones. No pidan grandes validaciones, es sólo para que se orienten en como hacer una validación, si requieren mayor seguridad pueden agregarla.
[vb]
Function DigitoVerificador(Valor, Largo)
‘ Calcula el Digito Verificador de un Valor, para un largo determinado
Dim cAuxi
Dim nTotal
cAuxi = Trim(Left(Valor, Largo))
cAuxi = String(Largo – Len(cAuxi), “0″) + cAuxi
cPonderador = “97139713971397139713971397139713″
i = 1
nTotal = 0
For i = 1 To Largo
nDigito = CInt(Mid(cAuxi, i, 1))
nDigPond = CInt(Mid(cPonderador, i, 1))
nTotal = nTotal + nDigPond * nDigito – Int(nDigPond * nDigito / 10) * 10
Next
i = 0
Do While Int((nTotal + i) / 10) * 10 <> nTotal + i
i = i + 1
Loop
‘DigitoVerificador = Trim(Str(i))
DigitoVerificador = i
On Error GoTo 0
Exit Function
Function ValidoCBU(CBU)
If CBU = “” Then
ValidoCBU = false
Exit Function
End If
If not IsNumeric(CBU) Then
ValidoCBU = false
Exit Function
End If
If Trim(Mid(CBU, 8, 1)) <> Trim(DigitoVerificador(“0″ & Mid(CBU, 1, 7), 8)) Then
ValidoCBU = false
Exit Function
End If
If Trim(Right(CBU, 1)) <> Trim(DigitoVerificador(“000″ & Mid(CBU, 9, 13), 16)) Then
ValidoCBU = false
Exit Function
End If
ValidoCBU = true
End Function
[/vb]
