?
Solved

How to implement a bar code reader in vb

Posted on 2006-05-10
15
Medium Priority
?
768 Views
Last Modified: 2008-01-09
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!
0
Comment
Question by:eneate
  • 8
  • 6
15 Comments
 
LVL 19

Expert Comment

by:Shauli
ID: 16648628
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
0
 

Author Comment

by:eneate
ID: 16648938
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?
0
 
LVL 19

Expert Comment

by:Shauli
ID: 16654173
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
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:eneate
ID: 16661965
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.
0
 
LVL 19

Expert Comment

by:Shauli
ID: 16662200
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
0
 
LVL 2

Expert Comment

by:samstarkey
ID: 16671989
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/
0
 
LVL 19

Expert Comment

by:Shauli
ID: 16672070
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
0
 

Author Comment

by:eneate
ID: 16775302
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
0
 
LVL 19

Expert Comment

by:Shauli
ID: 16775435
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
0
 
LVL 19

Expert Comment

by:Shauli
ID: 16775450
Another link (quite popular) http://www.hallogram.com/ but relatively expensive....

S
0
 

Author Comment

by:eneate
ID: 16775813
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
0
 
LVL 19

Accepted Solution

by:
Shauli earned 2000 total points
ID: 16775899
In the documentation you should have the function declaration included. Copy and paste the function declaration into a module (any module) of your project.

You should look for something like :
    Declare Function BC_c128SETAUTO  Lib .......

S
0
 

Author Comment

by:eneate
ID: 16828484
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?
0
 
LVL 19

Expert Comment

by:Shauli
ID: 16829170
Maybe its the same problem as above: Are you sending to the printer the function result or the text itself?

S
0
 

Author Comment

by:eneate
ID: 16831292
This is the print command for the barcode text box

Printer.Print label.Text4.text
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question