VB 6 and barcode scanner


Thread Starter



I need some help here. I have to use VB to communicate with a barcode scanner thru a serial port. I havent worked in VB except some basic programming. I am supposed to read the barcode from the scanner and load it onto a mysql database. Is this possible? how long will it take to complete this project? I would like to get as much help as possible to make this work.

Thank u.
I did just that a few years ago with vb. It was my 2nd vb project. It is pretty much straight foward and should only take a few days depending on your knowledge of basic programming. I'll have to see if I can find a copy of the code. It's merely a matter of opening the serial port, reading the data, then closing the port. What type of scanner are you using, alot have extra characters that will need to be stripped. Some (datalogix) will send the data as inverted bcd so that gets a little trickey. Are you reading the same length of characters for each bar code. I'll get back to ya.

[email protected]
This is very easy to do. The barcode is actually just a font. The scanner decodes it and sends the decoded barcode as keyboard strokes to the computer. I know that the 3of9Barcode font is particularly popular.

Treat the barcode as if someone was doing data entry with a keyboard. A simple example would be to scan into a textbox and put code in the Change() event of that textbox that looks for the ending character of the barcode font. This is typically the * character (If you are using a Symbol Spark unit). It is also the beginning character before the actual data. If you scanned in something and the code behind the barcode was xyz123, what you actually scanned was *xyz123*. You have to parse out the 1st and last characters of the scan and when you get to the 2nd *, then write that value out to MySQL, or any other DB.

Hope that helps,
Hi js
It is quite easy to code using the MSComm control in VB. Send me the details on the bar-code scanner you are using and I'll send you a snippet of the code that can do this for you. I would also appreciate if you can send the docs on your barcode scnaner. This will help me figure out the protocol it uses. Email me at [email protected]

use the serial device library, set the parameters correct to the scanner. See what data comes in after a scan. Write data to the database with ADO object.

Should work within a week...

Very, Very simple to do. Use the VB comm. control. set parameters to match the scanner. (must be decoded scanner). Make sure when you read the barcode data, you strip off all white space characters (if any exist!) by using the trim command. (ie, t$=trim(commBuffer$)). ALso, make sure to set the receive buffer large enough to receive ALL OF your data! After reading the buffer contents, make sure to clear out the commport receive buffer. (this is just good programming discipline.) If you have multiple devices, you may want to use a multiport serial card. Moxa, Commtrol, B&B electronics are a good source. I have used the RocketPort from Commtrol.
(http://www.comtrol.com). I have never used MySql, but my application was with VB6 and MSAccess. Have fun!

Michael R. Batchelor

Before you just willy-nilly strip off the white space, MAKE YOUR CUSTOMER tell you what's correct for thie application.

Stripping the white space like a good programer should cost me days of rework on a job once.

Michael R. Batchelor - Industrial Informatics, Inc.
Contribute to society: http://www.distributed.net/ogr/