Click here to Skip to main content
Licence CPOL
First Posted 1 Feb 2006
Views 51,376
Bookmarked 41 times

How to Generate Check Digits and verify your barcodes

By | 28 Sep 2006 | Article
Generates Check Digits and alows you to verify proper scan of a barcode
Prize winner in Competition "VB.NET Jan 2006"

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

Software Developer (Senior)
www.ruskin.com
United States United States

Member

PC Programmer/Analyst

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 5 PinmemberHeaven20209:16 5 Nov '10  
Question how to generate barcode using UPC-A Pinmemberyutahiga13:53 3 Mar '10  
AnswerRe: how to generate barcode using UPC-A PinmemberPolymorpher14:00 3 Mar '10  
Generalthanks for this nice work PinmemberRola /anglian/23:59 11 Jun '07  
GeneralRe: thanks for this nice work PinmemberPolymorpher6:49 12 Jun '07  
GeneralNIce PinmemberAnthony Queen3:57 29 Sep '06  
GeneralRe: NIce PinmemberPolymorpher6:20 29 Sep '06  
Thanks, Next time you will have one Wink | ;)
 
P.S. This or any other article I post here I consider completely open source so you or anyone else can feel free to modify and or use them in your projects...just dont hold me liable for any damages...had to throw that in there LOL.
 
Pablo
Sometimes I think there's no reason to get out of bed . . . then I feel wet, and I realize there is.

GeneralDon't limit yourself PinmemberCharles K. Kincaid4:41 21 Mar '06  
GeneralRe: Don't limit yourself PinmemberPolymorpher15:04 21 Mar '06  
GeneralRe: Don't limit yourself PinmemberPolymorpher10:52 3 Oct '06  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120529.1 | Last Updated 28 Sep 2006
Article Copyright 2006 by Polymorpher
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid