Click here to Skip to main content
6,596,602 members and growing! (20,190 online)
Email Password   helpLost your password?
General Programming » Algorithms & Recipes » Algorithms     Intermediate License: The Code Project Open License (CPOL)

How to Generate Check Digits and verify your barcodes

By Polymorpher

Generates Check Digits and alows you to verify proper scan of a barcode
VB.NET 1.1, WinXPVS.NET2003, Dev
Posted:1 Feb 2006
Updated:28 Sep 2006
Views:42,137
Bookmarked:36 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
Prize winner in Competition "VB.NET Jan 2006"
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
12 votes for this article.
Popularity: 4.14 Rating: 3.84 out of 5
2 votes, 16.7%
1

2
2 votes, 16.7%
3
2 votes, 16.7%
4
6 votes, 50.0%
5

Sample Image - BarcodeCheckDigAndVerify.png

Introduction

This only does 12 digit barcodes for now. if your interested in how this works go to
www.howstuffworks.com/upc.htm whichi is where I got most of my information. I just thought it would be nice to have a quick function to do the math for me and figured I should share ;)

a basic summary goes something like this:

To figure out what the chekdigit is suposed to be add together all of the odd digits and multiply by 3, then add all the even digits and add to the last result. Then find the number that when added to that makes it evenly divisible by to (10-(total mod 10))

To make sure a barcode is valid just do the same math but at the end say (total mod 10)==0

Its fairly basic but seems a little backwards on a string since they are zero based arrays. You just swap evens for odds

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Polymorpher


Member
PC Programmer/Analyst
Occupation: Software Developer (Senior)
Company: www.ruskin.com
Location: United States United States

Other popular Algorithms & Recipes articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 7 of 7 (Total in Forum: 7) (Refresh)FirstPrevNext
Generalthanks for this nice work PinmemberRola /anglian/0:59 12 Jun '07  
GeneralRe: thanks for this nice work PinmemberPolymorpher7:49 12 Jun '07  
GeneralNIce PinmemberAnthony Queen4:57 29 Sep '06  
GeneralRe: NIce PinmemberPolymorpher7:20 29 Sep '06  
GeneralDon't limit yourself PinmemberCharles K. Kincaid5:41 21 Mar '06  
GeneralRe: Don't limit yourself PinmemberPolymorpher16:04 21 Mar '06  
GeneralRe: Don't limit yourself PinmemberPolymorpher11:52 3 Oct '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 28 Sep 2006
Editor: Chris Maunder
Copyright 2006 by Polymorpher
Everything else Copyright © CodeProject, 1999-2009
Web22 | Advertise on the Code Project