
Newbie Q2: Using a bar code scanner with VB
: I was wondering if it was possible to use a barcode scanner with VB. Specifically,
: the scenario is this:
:
: Currently, an associate in manufacturing can access a bunch of on-line work instructions (written in MS word) by clicking buttons on a front-end interface developed in VB. There has been some discussion of using a bar-code scanner whereby an associate
can scan the serial number for a particular model and get specific info pertaining to work instructions (which will still be in MS word files) associated with the features for this model.
: I hope this makes sense
: Would appreciate if anyone has info to my query. Thanks in advance,
Well, I don't have a way that you can access a bar code reader directly,
but I used a solution to this very problem in a program I wrote. Here is
what you do:
When you purchease a bar code scanner, you usually get a WEDGE with it.
The wedge is the interface between the actual wand and the computer. It
is the brains that turns CODE39/UPC/etc into bits. Once the wedge turns
the bar code into bits, it can then send them to the computer in a
variety of ways; The most common is a Serial Port wedge - it sends the
bits to a serial port. A second is the Keyboard Wedge - it actually
injects the bits into the keyboard port, so the computer does not know
the difference between the bar code and keyboard input.
So... here is what you do. To add bar code input to a Visual Basic
program, buy a wand with either a Keyboard wedge or a Serial Port wedge.
If you get a keyboard wedge, then when you want to read a bar code all
you do is put the focus on a text box, and BEEP they scan the bar code
and the code appears in the box just like they typed it in at the
keyboard (most wedges end a transfer with a carriage return; trap this
with a watch for chr$(13) in the ON_KEYPRESS event or an "OK" button with
button.default=true). If you get a serial wedge, then you need a program
called PORTKEY; it is a special program (avaliable from worthington, a
bar code equipment manufacturer) that recieves the barcode input from the
serial port, and shoves it into Windows' keyboard buffer, which
effectivly shoves it into whatever textbox/form/whatever has the focus at
that moment.
True, both of these messages *DO* run the risk of some dingaling scanning
a bar code at the wrong time and having it appear in the wrong place or
the wrong application, but then the same dingaling can cause the same
effect by dropping a joystick on the keypad portion of his keyboard (not
that *I* have ever done that...)
Hope that helped.
Strongbow Wolfrider
Colin Ritchie