How do I get a Symbol barcode scanner to read a barcode and write it to a text box?

  • Thread starter Thread starter FloppyBriefcase
  • Start date Start date
F

FloppyBriefcase

Guest
Im doing a tutorial on taking a Symbol Scanner and reading from it. I then want to write the barcode to a textbox to see if it works.

I have a DS3408 with a RS232 connected to a serial server which converts it to an ethernet and connects to my laptop. The scanner works

in Hyperterminal, but when I try to use it in the Vb.net application below it does not show any data read when I scan a barcode. Im

using VS 2010 and my laptop is windows 7(hopefully that is not causing any compatibility issues). What is wrong with my code and needs

to be changed or is it not my code that is causing any problems? I am not getting any errors when I run the code. Thank you in advance.



This is the code:

Imports System
Imports System.Data
Imports System.Linq
Imports System.Collections.Generic
Imports System.Text
Imports System.ComponentModel
Imports System.Windows.Forms
Imports Symbol
Imports Symbol.Barcode


Public Class Form1
Private MyReader As Symbol.Barcode.Reader = Nothing
Private MyReaderData As Symbol.Barcode.ReaderData = Nothing
Private MyEventHandler As System.EventHandler = Nothing


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)

MyReader = New Symbol.Barcode.Reader
MyReaderData = New Symbol.Barcode.ReaderData(Symbol.Barcode.ReaderDataTypes.Text, 7905)
MyReader.Actions.Enable()
MyEventHandler = New System.EventHandler(AddressOf MyReader_ReadNotify)
AddHandler MyReader.ReadNotify, Me.MyEventHandler

MyReader.Actions.Read(MyReaderData)
End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
MyReader.Actions.Flush()
MyReader.Actions.Disable()
MyReader.Actions.Dispose()
MyReaderData.Dispose()
End Sub

Private Sub MyReader_ReadNotify(ByVal o As Object, ByVal e As EventArgs)

TextBox1.Text = MyReader.Actions.NewReaderData.Text
MyReader.Actions.Read(MyReaderData)

End Sub

End Class

Continue reading...
 
Back
Top