Link to home
Start Free TrialLog in
Avatar of eneate
eneateFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to implement a bar code reader in vb

Hi

I have a Gryphon D100 bar code reader. I need tobe able to scan a bar code into my vb application and for it to appear in a text box as a bar code. I have a text box behind which I have added suitable bar code fonts. I have checked the install of the reader and after sveral problems it appears tobe ok.
When I try it in my application nothing is input, anyone any ideas on this, I've tried lots of options and fonts and frustratingly come up with nothing. Help!
Avatar of Shauli
Shauli

To read a barcode you don't need barcode fonts. You need the fonts only when you want to CREATE a barcode.
1. Set the textbox to any normal font.
2. Make sure the barcode you are trying to read can be read by the scanner. Not all scanners can read all types of barcodes. The Gryphon D100 can read most of the 1D barcodes, that is barcodes that appear with straight lines, as opposed to the 2D barcodes, which appear as scrambled images.
3. Most barcodes come with a setup set of barcodes. Make sure you are back to "Factory settings". These are normally sufficient for most of 1D scanning.

FWIW

S
Avatar of eneate

ASKER

THanks for the feedback, I don't actually want to create fonts but I do want the scanned bar code to appear as a bar code in my text box, will this work?
Well, here is the problem: What the scanners do, they decode the barcode so you can display the text behind the barcode. Barcode is created by a formula. The formula varies from barcode type to barcode type. For example, with code 128, each character is built of three "normal" characters, and there must be an "opening" character and a "close" character. For that, there are functions, included in DLLs, normally provided with the barcode fonts. So, to make the long stroy short, what you need to do, if you want to display the barcode itself, is to first decode it, and then, using the provided function, to re-encode it and display it, using the barcode font. But why would you want to display the barcode itself, just for graphics? Usually you want to display the text the barcode represents, or don't you?

S
Avatar of eneate

ASKER

For my application I don't want the code that the bar code displays. This application reads a bar code from a document, it then needs to add that bar code to the next document so that the next person viewing it can read it from a reader, so yes I need to literally copty the bart code it's self and have it reappear as a bar code NOT text on my text box.
So, as I mentioned above, barcode scanners do not return bsrcodes, they return real text DECODED from barcodes. That is why I said above that after you scann the barcode, you will have to re-encode it. To re-encode (to create a barcode) you can do it the hard way, using the documentation of the required font, or you can use a function, normally provided with the fonts (ina dll file). Check the documnetation of the fonts you have.
Otherwise, if the barcode does not change from document to document, and is always the same, you can use an image instead of fonts.
Sorry to disappoint you, but you need to understand the simple fact that barcode scanners decode the barcode. This is the purpose of their existance. And therefore if you want to display the barcdoe itself, you need to re-encode.

http://www.azalea.com/FAQ/FAQ.html

http://en.wikipedia.org/wiki/Barcode#Symbologies

S
I'm confused myself, agreed the scanner decodes the bar code and returns real text based on the barcode formula.  But If that real text string is fed into a text box / label set to a font of (lets say) code 39 that would automatically provide the open and close character for that code, allowing you to print the same code.  Unfortunatley i'm not at work so I cant test this but here is a site that will provide the code 39 font for free.

The same would be if you manually types the digits below the bar code into the text box, it would produce the same code

http://www.barcodesinc.com/free-barcode-font/
samstarkey,
<<The same would be if you manually types the digits below the bar code into the text box, it would produce the same code>>
No, it would not. The formula that creates a barcode combines 3 characters for EACH barcode character. It is NOT just typing the number 123456789 and it will present it in barcode fonts. Each number is built, using a formula to encode it. Each character is built of three "normal" characters.
That's the way it goes. Sorry.

S
Avatar of eneate

ASKER

Hi

Sorry I've been away with no internet access !!! Owch

I now have a bar code scanner that works and yes it does read the bar code and display the numbers or text. I have some demo fonts that when placed behind the text box appear as a bar code eith from the scanner or manually tyoing in numbers. However I assumn from your post that this will not actually work and I'll need some software which will allow me to integrate the  reencoding of the information into the text box.

I have looked at the links you pasted and email one of the companies for more info. Do you have any recomendations that you could make for software that would do this?

Cheers
Its not really a software that you need. What you need is to either code the function yourself, or look for (buy, maybe) a DLL that includes such a function. However, first thing first.

Step 1: Decide which symbology (what you call "font") you want to work with. Each symbology represent a diffrent way of encoding. Some do only numeric, some do only alpha, some do both. For numeric, the most common symbology would be code 39, and for alpha numeric - code 128. I assume you will go with code 128.
Step 2: Install the fonts, and if you intend to distribute youe software, include the font installation in your deployment package.
Step 3: Build the function. When you purchase the fonts, they come with white papers. The white papers include step by step instruction of how to build the function that encodes the barcode. However, if you don't want to spend the time coding the function, then in addition to the link I already provided above (which includes a DLL once you buy the font), here is another one, http://www.idautomation.com/fonts/tools/sourcecode/#VB .
Once the function is ready, bought or built, you will be ready to display/print barcodes.

Good luck,

S
Another link (quite popular) http://www.hallogram.com/ but relatively expensive....

S
Avatar of eneate

ASKER

Hi

I've downloaded some demo software for the 128 font from fontware.com. It is supposed to have activex dll access. I have included it in the reference but when I add the command such as c128SETAUTO (Text1) I just get function not availbale or found, any idea where I am going wrong? Sorry but I have never worked with bar codes before so this is all new. Thanks
ASKER CERTIFIED SOLUTION
Avatar of Shauli
Shauli

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
Avatar of eneate

ASKER

Hi

Finally on line again. The declare function doesn't work in vb only c. BUt I do now have it working so many thanks.
One final query, I am using a bar code label printer but the printer is only seeing the text not the bar code any idea why?
Maybe its the same problem as above: Are you sending to the printer the function result or the text itself?

S
Avatar of eneate

ASKER

This is the print command for the barcode text box

Printer.Print label.Text4.text