Quick Search for:  in language:    
Determines,type,Credit,Card,number
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
Click here to see a screenshot of this code!Xp Frames , Xp List Box And XpTextBox (updated!)
By ali s on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Excel Into a webpage
By Bill Donahue on 7/2

(Screen Shot)

Unroll2 - Update
By Cyber Chris on 7/2


MultilinePWD
By Cyber Chris on 7/2


Click here to see a screenshot of this code!Song/Poem Assistant
By Peter Rowan on 7/2

(Screen Shot)

Click here to see a screenshot of this code!GPA Cal
By KBM-00 on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Connection Via the Telephone line.No internet or cable.Just the telephone line
By Nass ClickMan on 7/2

(Screen Shot)

DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Credit Card Identification

Print
Email
 

Submitted on: 5/27/1998
By: John Anderson  
Level: Not Given
User Rating: By 102 Users
Compatibility:VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0

Users have accessed this code 13160 times.
 
 
     Determines type of Credit Card by it's number.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

'**************************************
' Name: Credit Card Identification
' Description:Determines type of Credit 
'     Card by it's number.
' By: John Anderson
'
' Inputs:Card Number as String
'
' Returns:Card Type as String
'
' Assumes:This is based on documents fro
'     m CyberCash's home page.
'
' Side Effects:Is not Year 2061 Complian
'     t
'
'This code is copyrighted and has' limited warranties.Please see http://w
'     ww.Planet-Source-Code.com/vb/scripts/Sho
'     wCode.asp?txtCodeId=903&lngWId;=1'for details.'**************************************

Public Function CardType(CCNum As String) As String

Dim Header As String Select Case Left$(CCNum, 1) Case "5" Header = Left$(CCNum, 2) If Header >= 51 And Header <= 55 And Len(CCNum) = 16 Then CardType = "MasterCard" End If
Case "4" If Len(CCNum) = 13 Or Len(CCNum) = 16 Then CardType = "Visa" End If
Case "3" Header = Left$(CCNum, 3) If Header >= 340 And Header <= 379 And Len(CCNum) = 15 Then CardType = "AMEX" End If
If Header >= 300 And Header <= 305 And Len(CCNum) = 14 Then CardType = "Diners Club" End If
If Header >= 360 And Header <= 369 And Len(CCNum) = 14 Then CardType = "Diners Club" End If
If Header >= 380 And Header <= 389 And Len(CCNum) = 14 Then CardType = "Diners Club" End If
If Header >= 300 And Header <= 399 And Len(CCNum) = 16 Then CardType = "JCB" End If
Case "6" Header = Left$(CCNum, 4) If Header = "6011" And Len(CCNum) = 16 Then CardType = "Discover" End If
Case "2" Header = Left$(CCNum, 4) If (Header = "2014" Or Header = "2149") And Len(CCNum) = 15 Then CardType = "enRoute" End If
If Header = "2131" And Len(CCNum) = 15 Then CardType = "JCB" End If
Case "1" Header = Left$(CCNum, 4) If Header = "1800" And Len(CCNum) = 15 Then CardType = "JCB" End If
End Select
If CardType = "" Then CardType = "Unknown" End Function


Other 1 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
4/14/1999 12:36:00 AM:leyo
Do you also have a code that also 
checks the card expiraton? coz' I got a 
code in jscript that has it, but I 
can't understand it.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/1/1999 3:17:00 PM:Jamesredwood
Yeah, Can we have some expiration date 
code Please. Useless without.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/14/1999 8:53:00 AM:Eric Paulson
Very useful algorithm!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/18/1999 1:14:00 PM:Timothy Duemig
I've written many routines like this... 
for all of you wanting to know the date 
validation simply read in the date as a 
string by using a combination of 
instr(), mid(), left(), and right(). 
Use the Replace function to change 
char(s) when needed.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/19/1999 1:30:00 PM:lisa
just what I needed, thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/15/1999 5:52:00 PM:hey
Tim: Your answer to the date questions 
do not help at all, could you just post 
the date code too? thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/28/1999 6:20:00 PM:doo
what buttuns and other stuff do i need 
on the form?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/19/2000 6:38:03 AM:jeff
how would i make a textbox display the 
card type?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/6/2000 9:34:56 AM:Detonate
jeff:
Text1.Text = 
CardType("5353000000000000")
John, 
good submission :-)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.