Try This
Copy and Paste the following
Private Function InitReader() As Boolean
' If reader is already present then fail initialize
If Not (Me.MyReader Is Nothing) Then
Return False
End If
'Create new reader, first available reader will be used.
Me.MyReader = New Symbol.Barcode.Reader
'Create reader data
Me.MyReaderData = New Symbol.Barcode.ReaderData( _
Symbol.Barcode.ReaderDataTypes.Text, _
Symbol.Barcode.ReaderDataLengths.MaximumLabel)
' create event handler delegate
Me.MyEventHandler = New System.EventHandler(AddressOf
MyReader_ReadNotify)
'Enable reader, with wait cursor
Me.MyReader.Actions.Enable()
'Me.MyReader.Parameters.Feedback.Success.BeepTime = 0
'Me.MyReader.Parameters.Feedback.Success.WaveFile = "\\windows\
\alarm3.wav"
AddHandler Me.Activated, New EventHandler(AddressOf
FrmTrxn2_Activated)
AddHandler Me.Deactivate, New EventHandler(AddressOf
frmtrxn2_Deactivate)
Return True
End Function
'Stop reading and disable/close reader
Private Sub TermReader()
'If we have a reader
If Not (Me.MyReader Is Nothing) Then
'Disable reader, with wait cursor
Me.MyReader.Actions.Disable()
'free it up
Me.MyReader.Dispose()
' Indicate we no longer have one
Me.MyReader = Nothing
End If
' If we have a reader data
If Not (Me.MyReaderData Is Nothing) Then
'Free it up
Me.MyReaderData.Dispose()
'Indicate we no longer have one
Me.MyReaderData = Nothing
End If
End Sub
'Start a read on the reader
Private Sub StartRead()
'If we have both a reader and a reader data
If Not ((Me.MyReader Is Nothing) And (Me.MyReaderData Is
Nothing)) Then
'Submit a read
AddHandler MyReader.ReadNotify, Me.MyEventHandler
Me.MyReader.Actions.Read(Me.MyReaderData)
End If
End Sub
'Stop all reads on the reader
Private Sub StopRead()
'If we have a reader
If Not (Me.MyReader Is Nothing) Then
'Flush (Cancel all pending reads)
RemoveHandler MyReader.ReadNotify, Me.MyEventHandler
Me.MyReader.Actions.Flush()
End If
End Sub
'Read complete or failure notification
Private Sub MyReader_ReadNotify(ByVal o As Object, ByVal e As
EventArgs)
Dim TheReaderData As Symbol.Barcode.ReaderData =
Me.MyReader.GetNextReaderData()
'If it is a successful read (as opposed to a failed one)
If (TheReaderData.Result = Symbol.Results.SUCCESS) Then
'Handle the data from this read
Me.HandleData(TheReaderData)
'Start the next read
Me.StartRead()
End If
End Sub
'Handle data from the reader
Private Sub HandleData(ByVal TheReaderData As
Symbol.Barcode.ReaderData)
Try
Dim S as string
S= TheReaderData.Text
Catch ex As Exception
End Try
End Sub
' Called when the form is activated. This will occur when the
form becomes the current application.
Private Sub FORM_Activated(ByVal sender As Object, ByVal e As
EventArgs) Handles Me.Activated
'If there are no reads pending on MyReader start a new read
If Not Me.MyReaderData Is Nothing Then
If Not (Me.MyReaderData.IsPending) Then
Me.StartRead()
End If
End If
End Sub
And then Add this to Your Form Load Event
Try
If (Me.InitReader()) Then
'Start a read on the reader
Me.StartRead()
End If
Catch ex As Exception
'MsgBox("Scanner is not Available on this Device")
End Try
In the Hadle data sub you can open your other form
Dim F as new Form2
F.show
I hope all this helps