Forums
This topic is locked
Convert to Web Page
09 Jan 2006 15:38:06 aby aby posted:
Hi I'm a complete virgin to vb so can somebody please help to convert the script below to a html page or a page that I can upload which would be visible in internet explorer?
Public Function CreditCardType(ByVal strNumber As String) As String
Dim intLen As Integer
intLen = Len(strNumber)
'Mastercard
If intLen = 16 Then
Select Case CInt(Mid$(strNumber, 1, 2))
Case 51 To 55
CreditCardType = "Mastercard"
Exit Function
End Select
End If
'Visa
If intLen = 16 Or intLen = 13 Then
If CInt(Mid$(strNumber, 1, 1)) = 4 Then
CreditCardType = "Visa"
Exit Function
End If
End If
'American Express
If intLen = 15 Then
Select Case CInt(Mid$(strNumber, 1, 2))
Case 34, 37
CreditCardType = "Amex"
Exit Function
End Select
End If
'Diners Club / Carte Blanche
If intLen = 14 Then
Select Case CInt(Mid$(strNumber, 1, 2))
Case 36, 38
CreditCardType = "Diners"
Exit Function
End Select
Select Case CInt(Mid$(strNumber, 1, 3))
Case 300 - 305
CreditCardType = "Diners"
Exit Function
End Select
End If
'enRoute
If intLen = 15 Then
Select Case CInt(Mid$(strNumber, 1, 4))
Case 2014, 2149
CreditCardType = "enRoute"
Exit Function
End Select
End If
'JCB
If intLen = 16 Then
If CInt(Mid$(strNumber, 1, 1)) = 3 Then
CreditCardType = "JCB"
Exit Function
End If
End If
'JCB
If intLen = 15 Then
Select Case CInt(Mid$(strNumber, 1, 4))
Case 2031, 1800
CreditCardType = "JCB"
Exit Function
End Select
End If
End Function
' VB Document
Replies
Replied 10 Jan 2006 11:08:14
10 Jan 2006 11:08:14 Lee Diggins replied:
Hi aby
I think you're getting a little confused, the code you have posted is for a function that is processed at the server-side (normally for vbscript that is). You call a function to get some processing done and get some results back, in this case you're sending the value strNumber which is being worked on and the results are being passed back.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
I think you're getting a little confused, the code you have posted is for a function that is processed at the server-side (normally for vbscript that is). You call a function to get some processing done and get some results back, in this case you're sending the value strNumber which is being worked on and the results are being passed back.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>