How to programmatically scan bar codes?

sasllc
sasllc used Ask the Experts™
on
We have been using DataWedge for years to scan barcode data into text boxes on our forms, running on CE 5.0-based Symbol 9090s.  Now I need to know how to add the needed code to my vb app that will let it read that same barcode data without using DataWedge.  I have looked at the samples from Symbol, but they are making no sense to me.

I'm hoping someone can give me a CLEAR, understandable example of what code needs to be added, or can point me to a comparable, well-documented example...TIA

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
download the symbol sdk from the following url

http://support.symbol.com/support/search.do?cmd=displayKC&docType=kc&externalId=12623&sliceId=&dialogID=229930432&stateId=1%200%20229884705

there is a sample for barcode reading. It is actually very clear but if you have any questions, i would like to answer.

What you shouldn't forget is don't use datawedge and code at the same time. disable datawedge.

enable the barcode reading at the time you open the form that you are going to use it and on closing disable it. the device will consume less energy and also you will have less memory problems.
Commented:
Background: I've been writing vb programs for years for the 9090, using them in warehouses to collect data on the reader (and using datawedge all this time).  But after recently downloading v2.4 of the EMDK, looking at these examples:

VB_BarcodeControlSample1
VB_BarcodeSample1
VB_GenericReaderSample1
VB_GenericReaderSample2

I'm more confused than ever re: how to use get the data without datawedge.  I can't tell which of those is most like what I need.  Do you know?  All of these have numerous options, of course, but I'm just trying to find the basic, essential code that I need to get the job done.  All I need to know is how to make the laser fire when the user pulls the trigger, and get the corresponding data in.

Is the pulling of the trigger an event, similar to a keypress or a keydown?

Since we are both looking at the same code samples, and since it makes sense to you, maybe you can point me to the subs that make this work, or copy and paste them here.  I assume I need one sub to open the reader, one to close it, and one to read the data when the trigger is pulled.  Is that right?

The sample named VB_BarcodeControlSample1 has some subs that looked promising.  For example:

    Private Sub Barcode1_OnRead(ByVal sender As System.Object, ByVal readerData As Symbol.Barcode.ReaderData) Handles Barcode1.OnRead
        If readerData.Result = Symbol.Results.SUCCESS Then
            ' maintain a maximum of 10 items in the list box
            While ListBox1.Items.Count >= 10
                ListBox1.Items.RemoveAt(0)
            End While

            ' Write the scanned data and type (symbology) to the list box
            ListBox1.Items.Add(readerData.Text + ";" + readerData.Type.ToString)
        End If
    End Sub

But if I put that code in my program, I get two errors.  The first one says 'Type Symbol.Barcode.ReaderData is not defined', so I added Symbol.Barcode to the references to resolve that error.  The second error says 'Handles clause requires a WithEvents variable defined in the containing type of one of its base types'--whatever THAT means!?  This error is pointing to the word 'Barcode1' at the end of the first line in the code sample above.  Makes sense to me, since 'Barcode1' is not defined in my project.  So, I go back to the sample to see where 'Barcode1' is defined, and I see it is in the designer code, but I can't find it anywhere on the form--until I look at the bottom of the design screen and see it looking something like this:   * Barcode1   just above the error list area.  What is that?  I've never used anything like that on my forms.  How would I copy it over to my project, or add one like it to my project?

Since these important details are not at all clear to me, I would indeed like to take you up on your generous offer to clarify.  Ideally I would like to see the most basic code possible to open the reader, read in the data, and close the reader--if it's that easy.  Thanks so much!

   

Author

Commented:
And now I see where I can add that   * Barcode1   to the bottom of my form by opening the toolbox and double clicking on the one named 'Barcode' under the 'Motorola' section.  When I do that, then the 'Handles clause...' erro is resolved, but I get additional errors, such as:

'Results' is ambigous in the namespace 'Symbol'.
'UPC' is ambiguous in the namespace 'Symbol.Barcode'.

What do these mean, and how do I resolve them?

Author

Commented:
I am accepting my own answer because no effective answers were provided.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial