Important alert: (current site time 11/27/2014 3:55:02 AM EDT)
 

winzip icon

Barcode function EAN8 / EAN13

Email
Submitted on: 2/19/2003 4:22:26 PM
By: MstrControl  
Level: Intermediate
User Rating: By 8 Users
Compatibility: VB.NET, ASP.NET
Views: 54466
(About the author)
 
     After I read the "Code of the Day" of 2004/Feb/02 about barcode functions, I remembered about an old function of mine to draw EAN (8 and 13) barcodes. So I updated this code to work on .NET

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
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.


Other 7 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate 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

2/26/2003 9:25:54 AM

Hey Paulo,
Nice Code. Does it check for a check digit. If not how does that work.
Thanks -D
(If this comment was disrespectful, please report it.)

 
5/26/2003 10:47:11 AM

Hello,

I'd like to know what kind of license is shipped with this source code. My goal is to extend this code to support more barcode (code39, code128 ecc...), create a .net control and release it under GPL license (open source).

What do you think about?
(If this comment was disrespectful, please report it.)

 
12/5/2003 1:30:24 PMChris Pietschmann, MCSD, MCAD

Suggestion: You should draw the barcode on an Image object, and then assign the PictureBoxes image to that Image object. That way, it wont blank out the PictureBox when you minimize the window.

Great Code by the way. *****
(If this comment was disrespectful, please report it.)

 
2/25/2004 8:01:22 AM

I'd like to know haw this program work
PLEASE ANSWER ME !!!
(If this comment was disrespectful, please report it.)

 
7/6/2004 7:38:44 AM

Hi,
That's a nice piece of code u have there. However, can u explain the purpose of the following part of the code that in in your source. Thanks:

For K = 1 To Len(strAux) \ 2
Select Case CInt(Mid(strAux, K, 1))
Case 0
strExit
(If this comment was disrespectful, please report it.)

 
7/6/2004 7:40:24 AM

arghhh.......guess there weren't enough place to have even a little part of the code in. Anyway, what I don't understand is what is teh purpose of teh part of code that had the IIF function applied on?? Thanks
(If this comment was disrespectful, please report it.)

 
7/7/2004 12:00:30 AMPaulo S. Silva Jr

Quite simple: a little bit earlier I check to see the first digit of the EAN13 code that is coded by the way the bars are printed. So I save a variable strCode that has the coding scheme for the first EAN13 digit.

The IIfs checks for this code to apply the proper coding for each remaining digit.

I hope to solve your question.

Regards.
(If this comment was disrespectful, please report it.)

 
7/7/2004 7:43:20 AM

Hmmmm......I am a bit confused with the assign of binary code in the IIF function....since each digits from 0 to 9 has their own binary code, how do I know when to assign the correct binary code when checking through the EAN8 or EAN13 digits?? Because in each of your IIF functions, u already set 2 fixed binary code for each of the digit when the digit was not equal to 0, I was wondering how would u know exactly that the binary code assigned to the digit that checked is corect?? I mean it could be any digit that can be landed on the IIF function. I hope u can understand this question and it is not too long here :). Thanks
(If this comment was disrespectful, please report it.)

 
7/8/2004 12:54:47 AMPaulo S. Silva Jr

The IIfs part of the code codifies a binary representation of the EAN code, not a binary representation of ASCII code.

Do a table test of the function and you'll understand.

PJ

PS.: If you don't remember what a table test is... it's because I'm on this area WAY too long... :)
(If this comment was disrespectful, please report it.)

 
8/6/2004 11:28:07 PM

Hi,
Thanks for your explaination. Just one more question. How do you justify th esize of the barcode image by x width and y height??
(If this comment was disrespectful, please report it.)

 
8/27/2004 12:30:54 PMASPNETDevs

I ran it on .Net 2003
but does not draw nothing.
(If this comment was disrespectful, please report it.)

 
1/13/2005 4:49:14 AM

HI
I'm very glad to see this web about your code.
Thank U very much and I have a question for U that: Have you got any code about barcode reader. That can integrate with barcode reader and return the value so that I can receive it and use it?

(If this comment was disrespectful, please report it.)

 
1/13/2005 10:15:31 PMPaulo S. Silva Jr

Hi, Huong...

All the readers I know works attached to the keyboard port, or to the serial port...

So you'll need to find a code about serial ports and how to use them, if it's the case. If the reader is connected to the keyboard port it's pretty easy forward, don't you think?

I hope I helped.

Paulo
(If this comment was disrespectful, please report it.)

 
4/2/2005 4:38:26 PM

hi!
i have a question .... i want to use this code ... which file i'll have to work with plz tell me in detail
(If this comment was disrespectful, please report it.)

 
6/10/2005 10:34:59 AM

Hi I'm new to VB.Net. I like your Barcode Function and have learned alot from taking it apart. Question? How do you save it to a file? Smile
(If this comment was disrespectful, please report it.)

 
4/25/2006 3:45:22 AMIt's doesn't work

I print barcode by your program but scanner can't read it.

(If this comment was disrespectful, please report it.)

 
7/31/2006 5:38:08 AMAnusha

How to print this barcode through the printer, how to store it as an image object to store to a Picture Box
(If this comment was disrespectful, please report it.)

 
5/5/2007 3:54:01 PMFawad Ali

this barcode not scanable...through barcode reader
(If this comment was disrespectful, please report it.)

 
8/1/2007 4:16:52 AMrodrigo castro

how i save the barcode to a file?
i tryed save the picturebox but it did not work
thank you
(If this comment was disrespectful, please report it.)

 
8/21/2008 5:28:20 AMyulianto

hello there, did you know EAN 13 and EAN 8 have check digit?
for example, we input 7 number and one number behind the number is check digit.
we no input 8 or 13 number to create EAN 8 or 13 but we input 7 and 12 number. 8th and 13th number is auto generate
(If this comment was disrespectful, please report it.)

 
1/23/2011 9:56:45 PMsarifah

i can't scan the barcode with the scanner.can you explain to me and how to solve it..
(If this comment was disrespectful, please report it.)

 
9/18/2012 8:42:08 AMpaolo

Hi, donloaded your code and developed an apllication. now I'm trying to print the barcode but any scanner I use, read the code (EAN8). what should I do?
Thanks
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.