Hello,
There are two basic ways of generating barcodes in VB:
1. Barcode font. The easiest font to use is Code 39. The only
requirement for Code 39 is that you use an asterisk "*" before and
after the data you wish to encode. So, for example, to encode 12345
into a barcode with that value, you can simply type *12345* into the
text box on your form. You also need to make sure the Font property
of the text box is set to the corresponding Code 39 font.
One more thing to keep in mind is that if you wish to encode a space
character, you will need to substitute it with (usually) an underscore
"_".
So, if you wish to encode "123 ABC", you'll have to change it to
"*123_ABC*"
You can set up a simple function to encode the data:
Public Function FormatCode39(d As String) As String
FormatCode39 = "*" & Replace(d, " ", "_") & "*"
End Function
That's all there is to it.
Of course, if you need fonts other than Code 39, it becomes more
complicated. You may need to calculate the check digit(s) and do
other calculations.
2. The second, and easier way to add barcodes to VB is by using an
ActiveX Control (a plug-in). You simply go to Project->Components,
and select "BarcodeWiz 1.60 Type Library".
There is no need to insert start/stop characters nor any other
calculations/substitutions. You can also choose the barcode type,
such as Code 39, Code 128, UPC, EAN 128, Codabar (used commonly in
libraries), and others. Most barcode ActiveX controls support several
different symbologies.
With an ActiveX control, you can also control many other properties of
the barcode, such as bar width, height, type of border, color, fonts,
orientation, text position, and more.
If you'd like to try either our Code 39 fonts or the barcode ActiveX
control, please have a look at our download page:
http://www.barcodewiz.com/demo.asp
Both downloads include several examples of use in Visual Basic 6.
Also, the help file includes step-by-step instructions for setting
everything up.
If you have any questions, please don't hesitate to ask.
Alek Szymanski
http://www.barcodewiz.com