Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Barcode in VB 6 1

Status
Not open for further replies.

sonper

Programmer
Oct 4, 2001
94
PH
Hi guys!

Anybody here has a code on how to read a barcode in VB 6? I have attached a barcode reader on COM2 and I just want to know exactly if its really working by displaying the digits read on a textbox.

Thanks in advance.
 
Should be fairly simple. You need to place the mscomm control on your form and set the properties to match your situation. Set up a MSComm1.CommEvent sub to copy the input to your textbox. Could be as simple as Text1=MSComm1.Input.
 

After installing the software for the reader you can start notepad and scan in a couple of barcodes. This will tell you if it reader and software are working correctly. This will also tell you some of the features of the software (does it automatically add a vbcrlf or not). Once you have this verified you can then easily use it in any program you wish to design as long as it is working correctly.

As for mhkwood's suggestion, I never tried it and I am not sure that it will work since it is the software (at least the system I have worked with) that interprets what the reader reads and then converts that (if recognizable) into ascii.

Good Luck

 
If it is a rs232 (serial interface) scanner, the data should come across and be readable. There is some extra junk in there that needs to be filtered out for real use, but you should see the barcode data.

On another thought, if you just want to make sure it is working, you can use hyperterm to capture the data. See courtesy of PSC (Percon).
 
mhkwood,

I can see the data now! But why is it that on some barcodes, there appeared an extra junk at the end of the data? Does at it has a certain format that should be followed?
 
Well, that depends upon the brand/model of the scanner, how you have it set up, and what kind of barcode you are reading. Post the details and I'll help if I can. Also post the output for one of the barcodes with the extra garbage (cut and paste).
 
mhkwood,

The junk appears to be like a bar (in bold) e.g. 12004▐. Anyway, thank you so much. I'll just use the format that works. What is important is that now I can see the data. I'll just discard the junk, it's the last data anyway.

Thanks again and God bless!
 
Sonper,

Default (factory) setup for most barcode scanners is that they will add an additional suffix to the code.
This suffix is almost always a linefeed (as already mentioned).

The only barcode scanners I support are keyboard wedge, meaning that scanning a barcode is identical to tapping on the keyboard, so can't help you to a code example.

Does at it has a certain format that should be followed?
We need to consider 2 separate issues here:
1. (optional) additional characters (scanner dependent)
A scanner can be setup to add prefix (typically <Tab>) and suffix data to a barcode. For this, one need to reference the scanner manual
Some can even be setup to send barcode marker data (fe. Interleaved 3 of 9 requires a * or ! as start- and stop marker, which will normally be stripped by the scanner), or strip control numbers from the barcode
2. barcode format itself
Barcodes themself come in different flavours. From basically simple (alpha numerical data containing whatever) to normalized forms (fe. EAN, JAN, UPC), in which the barcode is build to set rules
However, this is only an issue when you want to process the barcode iso just reading them.
Diederik
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top