Visual Basic - Validar Targeta de Credito !!!!!Urgente!!!

Life is soft - evento anual de software empresarial
 
Vista:

Validar Targeta de Credito !!!!!Urgente!!!

Publicado por Victor Benitez (1 intervención) el 14/11/2000 00:00:00
Hola a todos, necesito una funsion que me permita validar una targeta de Credito (nº, fecha vencimiento, etc)

Cualquier ayuda sera bienvenida

Saludos desde Chile
Victor Benitez
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Validar Targeta de Credito !!!!!Urgente!!!

Publicado por Mónica (9 intervenciones) el 17/11/2000 00:00:00
Te envio una función para validar una tarjeta de crédito. De todas maneras te envié un correo por si acaso no te llega bien.

Public Function IsValidCreditCardNumber(ByVal sCardNo _
As String) As Boolean

´Must get rid of "-" and " " characters before calling this
´function

´alternatively, add Replace(sCardNo, "-", "") and
´Replace (sCardNo, " ", "")
´to the beginning of the function

Const MAX_DIGITS = 20 ´ actually don´t know any
´card using more than 16 digits

Dim anDigits(1 To MAX_DIGITS) As Byte
Dim nDigits As Long

Dim ofsCurrentDigit As Long
Dim ofsCurrentCharacter As Long

Dim CurrentCharacter As String

Dim Multiplier As Long
Dim CheckSum As Long
Dim DigitValue As Long
Dim Result As Boolean

Dim ValidDigits As String

If Not IsNumeric(sCardNo) Then Exit Function
If Len(Trim$(sCardNo)) < 1 Then
Result = False
GoTo Exit_Point
End If

ValidDigits = "0123456789"

For ofsCurrentCharacter = 1 To Len(sCardNo)
CurrentCharacter = Mid$(sCardNo, ofsCurrentCharacter, 1)
If InStr(1, ValidDigits, CurrentCharacter, _
vbBinaryCompare) Then
nDigits = nDigits + 1
If nDigits > MAX_DIGITS Then
Result = False
GoTo Exit_Point
End If
anDigits(nDigits) = Val
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar