Link to home
Start Free TrialLog in
Avatar of liese79
liese79

asked on

Barcodes using VB?

can i prototype a barcode using VB? is it possible to draw the lines? wat other ways can i use to create the barcode?
Avatar of heder
heder

i highly recommend to use a barcode font
(truetype)

look at:
http://www.adams1.com/pub/russadam/fonts.html

http://www.fontware.co.uk/ean13.htm (follow the link to the download page)
http://www.riversedge.com/
http://www.softseek.com/Graphics_and_Drawing/Fonts/Barcodes/D_22649_index.html (but i think this is just a demo version)
http://www.abri.com/fonts.html


using a font is the best way, cause you just place a label on your form, choose the barcode font, and set the caption of the control correct

theire are also some activeX controls to produce bar codes, i prefere barcode fonts, cause they are more flexible (can be used in almost any app)



or you use
Line [Step] (x1, y1) [Step] - (x2, y2), [color], [B][F]

to draw lines on the form / picture box ...
The width of the line drawn depends on the setting of the DrawWidth property. The way a line or box is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.
I most positively can NOT recommend barcode fonts
 i have found that with cheap barcode reading systems they give a lot of errors
i have made my own barcode printing routine using the code 39 symbology and the vb drawing functions
If i use this to print a barcode with any laser or inktjet
any reader can read it
if printed to a good dotmatrix almost any reader can read it
furthermore if you use your own routine you can control every aspect of the barcode such as small bar,wide bar,inter character spacing ...etc

as heder said use
Line [Step] (x1, y1) [Step] - (x2, y2), [color], [B][F]
i did not check the above links i suppose you will find there code enough to do what you want if not i'll gladly post my code here
 


Avatar of liese79

ASKER

thx oreghe and pierrecampe...

well, i've downloaded the codes from the links provided above. but i've not tested them yet. thx... =)

pierrecampe, can u post ur codes here as well? thx.. =)

u guys take care ok? bye... all the best~
ASKER CERTIFIED SOLUTION
Avatar of pierrecampe
pierrecampe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are printing the barcodes on a report, I agree with the FONTS solution.

If, however, you are printing the barcodes on a Label, there are loads of label printers out there with internal barcode fonts. These produce the best quality barcodes easiest.

I have used BarFonts to include a barcode on an Access report. But I do more labeling projects than Access projects, and each one uses a dedicted label printer.
excellent solution pierrecampe!
Avatar of liese79

ASKER

hi there everyone, pierrecampe, can u explain the way the bar code works? i don really understand it, how come some bars r bold compared to other 'thinner' ones? =)

take care, all the best~
Hi liese
ok i'll try
this is a code39 barcode also known as code 3 of 9
wich means that every character in its characterset is made of 9 bars,of wich 6 are small bars and 3 are wide bars
example the character "1" has the following bars: "LSSLSSSSLI"
in wich "L" stands for a large(wide,bold) bar and "S" stands for a small(thin) bar and the "I" stands for the intercharacter space(just as in printed text there has to be a space between the characters)
so you could say that in the code39 alfabet "LSSLSSSSL" is what "1" is in the human alfabet
these bars are drawn using the VB Line method
now the code39 alfabet is made up of the 44 characters you see in the code
there is a ratio between large and small bars and there is also a ratio between a small bar and the intercharspace
the ratio i have used here is large bars are 2.1 times wider then small bars
and the intercharspace is equal to the width of a small bar
I have found this to work very good
you could ofcourse change these ratio's
COME TO THINK OF SOMETHING
maybe what you mean is why are some small bars thinner than other small bars ?(and for large bars to)
that liese is this thing prints to a form and a form is on a screen and a screens resolution is not good enouch
if you print to a printer you will see that all the small bars have the same width(large bars to)
i'll try to explain this
on my screen a pixel is 15 twips so if i draw a line thats between 16 and 29 twips wide the screen driver has to make a desition if it will use 1 or 2 pixels
the morale dont bother with the screen
if you where to make a routine to draw barcodes to the screen you will have to do some very exact calculations
and after all a barcode is meant to be printed on a piece of paper or something

hope this was of some help if not feel free to ask
Greetings
   
I have checked the above links and it turns out only one does not use fonts
but it uses a very intelligent and somewhat difficult to understand  solution representing each character as a binary
and an improvement to this routine using the api drawing methods wich is supposed to be 40 times faster
but what is 40 times faster then immediately ???
and a 40 times faster routine does not make the printer 40 times faster right?
so liese what you use is up to you
and if your client is rich and can afford expensive barcode readers and the royaltys on the fonts by all means use fonts they are very easy to use
If you want to be proud of what you do use VB

AGAIN IF SOMEONE KNOWS THE SYMBOLOGIES OF OTHER BARCODES PLEASE POST THEM HERE
maybe some of the font makers ??? (you'l make a lot less money but then you'l probably go to heaven)

Avatar of liese79

ASKER

pierrecampe, thanks for explaing the whole thing to me.. =)) hey, how do i reduce the size of the whole barcode? hehehehe.. cos it's kinda too big for my form.. can i reduce the size of it?
thx.. =)

liese(lisa)
liese i dont mean to be rude but have you studied the code? do you understand it ?
some advice NEVER use code you do not understand this is a MAJOR cause of bugs and will only get you into trouble
please excuse for this tirade (i am an old man)
so ok:
PrintBarCode39 "PIERRECAMPE", 30, 600
the 30 in this statement is the width of a small bar
Largebar = Smallbar * 2.1  
this is the width of a large bar ie:2.1 x 30 = 63
so if you replace 30 with 15 the small bar will have a width of 15 and a large bar a width of 15 x 2.1 =31.5
this will make the barcode about half the width
further more you could reduce the ratio between large and small bar to say 1.5
and this will make it even less wide
the 600 is the height of the barcode
reduce it to 300 and the height will be half the original
but liese a barcode is meant to be printed to paper and to be read by a barcode reader
so may i suggest you do not print to the screen forget about the screen
liese play along a bit with these numbers on a printer until your barcode reader can read it every time
again i did not mean to be rude so if you have any more questions feel free to ask
greetings

 
 
Avatar of liese79

ASKER

thx... =) no, u r not being rude. i did study the codes, but somehow, i didnt really understand it (i'm not really an expert in coding)... well, now that i understand more bout ur codes, i would be able to reduce the size. =)
anyway, i'm only doing a prototype for an electronic stamp. i want to get ur permission to use these codes in my project. this is an academic project... i'm currently doing my honours project.
permission granted and success on your project
and thank you for teaching me some shorthand
Avatar of liese79

ASKER

thxxx.... =)))
for everything that u've posted here... =))
u take care, n all the best to u~
=)
PC.....

perhaps the following info will aid your quest for additional symbologies.....

Standards & Specifications

AIM USA ''Uniform Symbology Specifications'':
      Interleaved 2-of-5 (Item X5-1)
      Code 39 (Item X5-2)
      Codabar (Item X5-3)
      Code 128 (Item X5-4)
Available from:
      AIM USA
      634 Alpha Drive
      Pittsburgh, PA  15238-2802
      Phone: 412-963-8588
      Fax: 412-963-8753

AIM Europe ''Telepen Uniform Symbology Specification''
Available from:
      AIM Europe
      The Old Vicarage, Haley Hill
      Halifax, West Yorkshire, HX3 6XX, UK

Phone: 01422 368368
      Fax: 01422 355604

ANSI X3.182, ''Bar Code Print Quality - Guideline''
Available from:
      The American National Standards Institute
      11 West 42nd St., 13th Floor
      New York, NY  10036
      Phone: 212-642-4900
      Fax: 212-398-0023
Also available from AIM USA (address above).

CEN Specifications
Available from:
      Commission for European Normalization
      36 Rue de Stassart
      B-1050 Bruxelles
      Belgium
      Phone: (32) 2.519.68.11

Fax: (32) 2.519.68.19

EAN Specifications
Available from:
      EAN International
      Rue Royale 29
      B-1000 Bruxelles
      Belgium
      Phone: (32) 2.218.76.74
      Fax: (32) 2.218.75.85
Also available from EAN National Authorities around the world and AIM USA (address above).

U.P.C. Specifications
UCC/EAN-128 Application Identifier Standard
Application Identifier Standard For Shipping Container Codes
Available from:
      The Uniform Code Council, Inc.

7887 Washington Village Drive
      Suite 300
      Dayton, OH  45459
      Phone: 937-435-3870
      Fax: 937-435-7317


good luck & have fun!
-kf
thank you kfrick
I'll first try belgium (thats where i live)
Liese how about clicking on 'accept comment as answer'
seems like a good idea to me
Avatar of liese79

ASKER

Comment accepted as answer
Avatar of liese79

ASKER

hey pierrecampe... erm... i don know whether did i do the rite thing of accepting ur comment as answer o not... this is my first time... well, really want to thank u for all that u've taught me.. i'm sorry if i did the wrong thing during the procedure of accepting ur answers... thx .. take care of urself.. all the best!!
Avatar of liese79

ASKER

pierrecampe... how many points were added to u? how do i increase the points for u?
Liese this question now rates 10 points
so i suppose you gave me 100 points
dont give me more points
you could use your points in the future
Hi all .

How can I download free barcode fonts ( ex: Code 39 , Code 128 etc. ). That should not be demo version. I want only free download . If you are know the links please send to me .

Thanks All

Best regards .

PChandima .
Dear Expert " Pierrecampe "

                                      instead of  you give example, How do i write code to use combo box select a values from table
and generate to barcode? could you please help me to do?

Private Sub Command1_Click()
   InitBarCode39
   PrintBarCode39 "PIERRECAMPE", 30, 600
End Sub

Thank you