I am using VB.net (2008) and CE 5.0
In a form in my application there will be a few fields shown say ( id , colour, name, var1, etc ... ) The user needs to manually enter some of these values.
When the user of the workabout scans the RFID I want to fetch the values out of the database and refresh the screen with that id's data.
If I use the keyboard wedge I think the focus has to be on the command box and so it would be like typing the id in and pressing enter. But I see difficulty if the user has the focus elsewhere. So is there a way to move the focus to the command box first? Or capture the scan event somehow?
Any suggestions or hints or links to examples would be appreciated.
Bill
Good morning Bill,
Bill is there a way to move the focus to the command box first? Or capture the scan event somehow
The answer is YES to both above questions.
This said, I would opt for option #2 « capture the scan event »
Indeed, you can use our Mobile Devices SDK barcode namespace to » be notified when a barcode is read» receive the barcode data (and then display it wherever you'd like)
vvvv
& Our Mobile Devices SDK comes with .NET samples .NET demo solutions can also be found on our community portal
E.g. click this search link
Kind regards,Jacques
Which version of the "Mobile Devices SDK" should I use? Probably MDSDK 5.4?
Right you are
Thanks Jacques,
Well I have connected to my workabout pro 5 ( win ce 5.0 ) and deployed your test application and it runs but scannertest.vb and scannertest2.vb don't get the data when I press the scan button. Is there something else to do to get that to work?
Good afternoon Bill,
Billscannertest.vb and scannertest2.vb don't get the data when I press the scan button.
Can you please confirm / deny
Both forms get shown from the main form.
For the one on the left I press "Enable Scanner Driver" then press the scan button.But the READ light (i.e. BEAM?) does not come on. Perhaps this is the issue?
Bill,
BillBut the READ light (i.e. BEAM?) does not come on. Perhaps this is the issue?
This is indeed the problem.
If you close the Mobile Devices SDK VB .NET demo and for example open up the Microsoft WordPad and/or Demo Scanner (*) program, can you read barcodes at this stage?
(*) Start è Programs è Demo è Demo Scanner
Can you please provide us your device system properties?See the « Creating a System Properties file » article for further details
Have to leave it for today. Will resume tomorrow. Thank you.
I am getting closer now. I had to reset the scancode remap with settings/keyboard So 0038 is Trigger F24 virtual key ( not sure why this gotchanged - is there a way to programatically ensure this? )Now "ScannerTest.vb" works in that if the focus is in a text box the scanned value appears there.
But what I would like is to be able to capture the scanned value even if the focus is elsewhere.I tried putting "MsgBox(e.Text)" in the function Scanner1_ScanCompleteEvent but that didn't produce a result. Ideas?
Still no luck detecting the scancomplete event.
I do get this error in the vs2008 immediate window.
A first chance exception of type 'System.ApplicationException' occurred in PsionTeklogixNet.dll
I wonder if it is the wrond DLL for my unit?
Any more help would be greatly appreciated!
Bill0038 is Trigger F24 virtual key ( not sure why this got changed - ...)
Let me take a guess. Is your Workabout Pro device equipped with an Agrident RFID reader?If it is, you may alreday know that by default, the Agrident Interface Reader (AIR) is triggered by the virtual key F24.Click this link for further info.
Bill- is there a way to programatically ensure this? )
Our Mobile Devices SDK KeyRemapper class (member of PsionTeklogix.Keyboard namespace) can help you achieving this.
This said, in case you wish that the scanner keys act as scanner triggers or RFID triggers, let me bring few demos to your attention:
BillI tried putting "MsgBox(e.Text)" in the function Scanner1_ScanCompleteEvent but that didn't produce a result. Ideas?
The below code snippet illustrate how to overcome the difficulty (*) you encountered. In short, try to do as little as possible within the Scanner1_ScanCompleteEvent subroutine
Imports PsionTeklogix.Barcode
[...]
Private Sub Scanner1_ScanCompleteEvent(ByVal sender As System.Object, _ ByVal e As ScanCompleteEventArgs) _ Handles Scanner1.ScanCompleteEvent BeginInvoke(New ScannerCallbackDelegate(AddressOf ScannerCallback), _ New Object() {e}) End Sub Private Delegate Sub ScannerCallbackDelegate(ByVal e As ScanCompleteEventArgs) Private Sub ScannerCallback(ByVal e As ScanCompleteEventArgs) MsgBox(e.Text) End Sub
--
(*) In your case, the scanning bitmap is interfering with your message box, which of course is holding up execution of the callback function. Please, bear in mind to never put any type of modal dialog message box in the ScanCompleteEvent callback function.
Thanks Jacques.
I tried that code but the MsgBox(e.Text) still did not arrive.
The scan is initiated, there is a beep, it finishes, but no msgbox.
I will try your trigger demo
The ScannerCallback is not called. But why? If I could only get this one thing to work here.
Here is the completeScannerTest.vb
' Copyright (c) 2003-2010 Psion Teklogix Inc.' All rights reserved.' ' This material is proprietary to Psion Teklogix Inc. and, in addition to the above' mentioned copyright, may be subject to protection under other intellectual property' regimes, including patents, trade secrets, designs and/or trademarks.' ' This code and all related information is provided "As Is" and without warranty of' any kind, either express or implied including, but not limited to, warranties of' merchantability and/or fitness for any particular purpose.'' ' File: ScannerTest.vb' Description: Demonstartes the use of Scanner class'Option Explicit OnImports System.TextImports System.GlobalizationImports PsionTeklogix.ResourcesImports PsionTeklogix.BarcodePublic Class ScannerTest Inherits System.Windows.Forms.Form Friend WithEvents Scanner1 As PsionTeklogix.Barcode.Scanner Friend WithEvents ScannerServicesDriver1 As PsionTeklogix.Barcode.ScannerServices.ScannerServicesDriver#Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) MyBase.Dispose(disposing) End Sub 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents txtScannedValue As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents txtCodeIdentifier As System.Windows.Forms.TextBox Friend WithEvents btnScanner As System.Windows.Forms.Button Friend WithEvents btnDisableScanner As System.Windows.Forms.Button <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.Label1 = New System.Windows.Forms.Label Me.txtScannedValue = New System.Windows.Forms.TextBox Me.Label2 = New System.Windows.Forms.Label Me.txtCodeIdentifier = New System.Windows.Forms.TextBox Me.btnScanner = New System.Windows.Forms.Button Me.btnDisableScanner = New System.Windows.Forms.Button Me.SuspendLayout() 'Label1 ' Me.Label1.Location = New System.Drawing.Point(16, 24) Me.Label1.Size = New System.Drawing.Size(96, 16) Me.Label1.Text = "Scanned Value:" ' 'txtScannedValue ' Me.txtScannedValue.Location = New System.Drawing.Point(16, 40) Me.txtScannedValue.Size = New System.Drawing.Size(144, 20) Me.txtScannedValue.Text = "" ' 'Label2 ' Me.Label2.Location = New System.Drawing.Point(16, 80) Me.Label2.Size = New System.Drawing.Size(144, 16) Me.Label2.Text = "Code Identifier:" ' 'txtCodeIdentifier ' Me.txtCodeIdentifier.Location = New System.Drawing.Point(16, 96) Me.txtCodeIdentifier.Size = New System.Drawing.Size(144, 20) Me.txtCodeIdentifier.Text = "" ' 'btnScanner ' Me.btnScanner.Location = New System.Drawing.Point(40, 200) Me.btnScanner.Size = New System.Drawing.Size(152, 24) Me.btnScanner.Text = "Enable Scanner Driver" ' 'btnDisableScanner ' Me.btnDisableScanner.Location = New System.Drawing.Point(40, 240) Me.btnDisableScanner.Size = New System.Drawing.Size(152, 24) Me.btnDisableScanner.Text = "Disable Scanner Driver" ' 'ScannerTest ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.ClientSize = New System.Drawing.Size(238, 279) Me.Controls.Add(Me.btnDisableScanner) Me.Controls.Add(Me.btnScanner) Me.Controls.Add(Me.txtCodeIdentifier) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.txtScannedValue) Me.Controls.Add(Me.Label1) Me.Text = "Scanner" Me.MaximizeBox = False Me.MinimizeBox = False Me.ResumeLayout(False) End Sub#End Region ' Override the OnLoad handler in order to initialize the scanner ' Protected Overloads Overrides Sub OnLoad(ByVal e As EventArgs) Me.Scanner1 = New PsionTeklogix.Barcode.Scanner Me.ScannerServicesDriver1 = New PsionTeklogix.Barcode.ScannerServices.ScannerServicesDriver ' 'Scanner1 ' Me.Scanner1.Driver = Me.ScannerServicesDriver1 ' 'ScannerServicesDriver1 ' Dim iClickData As Integer = 0 'Double-clicking character: 0 (none) Dim iClickTime As Integer = 0 'Double-clicking period: 0 ms Dim bScanGoodBeep As Boolean = True '«Scan Good Beep» enabled Dim bScanIndic As Boolean = True '«Scan Indicator» splash screen enabled Dim bScanLogFile As Boolean = True '«Scan Log File» enabled Dim bScanResult As Boolean = True '«Scan Result» splash screen enabled Dim iResultTime As Integer = 1 'Display «Scan Result» splash screen for 1 second 'Retrieve few custom scanner properties and re-configure them only if needed. Try If (CInt(ScannerServicesDriver1.GetProperty("Scs\Click Data")) <> iClickData) Or _ (CInt(ScannerServicesDriver1.GetProperty("Scs\Click Time")) <> iClickTime) Or _ (Convert.ToBoolean(ScannerServicesDriver1.GetProperty("Scs\Scan Good Beep")) <> bScanGoodBeep) Or _ (Convert.ToBoolean(ScannerServicesDriver1.GetProperty("Scs\Scan Indic")) <> bScanIndic) Or _ (Convert.ToBoolean(ScannerServicesDriver1.GetProperty("Scs\Scan Log File")) <> bScanLogFile) Or _ (Convert.ToBoolean(ScannerServicesDriver1.GetProperty("Scs\Scan Result")) <> bScanLogFile) Or _ (CInt(ScannerServicesDriver1.GetProperty("Scs\Result Time")) <> iResultTime) Then Try Me.ScannerServicesDriver1.SetProperty("Scs\Click Data", iClickData) Me.ScannerServicesDriver1.SetProperty("Scs\Click Time", iClickTime) Me.ScannerServicesDriver1.SetProperty("Scs\Scan Good Beep", bScanGoodBeep) Me.ScannerServicesDriver1.SetProperty("Scs\Scan Indic", bScanIndic) Me.ScannerServicesDriver1.SetProperty("Scs\Scan Log File", bScanLogFile) Me.ScannerServicesDriver1.SetProperty("Scs\Scan Result", bScanResult) Me.ScannerServicesDriver1.SetProperty("Scs\Result Time", iResultTime) Catch ex As Exception MessageBox.Show("SetProperty() failed with " & ex.Message) Me.Close() Return End Try ' Apply the setting changes that were made by SetProperty calls. Try Me.ScannerServicesDriver1.ApplySettingChanges() Catch ex As Exception MessageBox.Show("ApplySettingChanges() failed with " & ex.Message) Me.Close() Return End Try End If Catch ex As Exception MessageBox.Show("GetProperty() failed with " & ex.Message) Me.Close() Return End Try MsgBox("OK") MyBase.OnLoad(e) End Sub Private Sub Scanner1_ScanCompleteEvent(ByVal sender As System.Object, _ ByVal e As ScanCompleteEventArgs) _ Handles Scanner1.ScanCompleteEvent BeginInvoke(New ScannerCallbackDelegate(AddressOf ScannerCallback), _ New Object() {e}) End Sub Private Delegate Sub ScannerCallbackDelegate(ByVal e As ScanCompleteEventArgs) Private Sub ScannerCallback(ByVal e As ScanCompleteEventArgs) ' MsgBox(e.Text) txtScannedValue.Text = e.Text End Sub ' btnDisableScanner_Click - event handler ' Private Sub btnScanner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScanner.Click Me.Scanner1.Enabled = True End Sub ' RunButton_Click ' Private Sub btnDisableScanner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisableScanner.Click Me.Scanner1.Enabled = False End Sub ' Close Form ' Private Sub ScannerTest_Closed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Closed Me.ScannerServicesDriver1.Dispose() End Sub Private Sub Scanner1_ScanEvent(ByVal sender As Object, ByVal e As PsionTeklogix.Barcode.ScanEventArgs) Handles Scanner1.ScanEvent MsgBox(e.GetType) End SubEnd Class
Can you please give this basic VB .NET scanner demo a try and let me know how it goes from your end?
Regards,Jacques
Can you tell me how to change it so that it deploys to windows CE 5.0 instead of windows mobile 6?I am still getting back up to speed with microsoft dev tools.
Also I have found a way to do what I want to do starting with the AirDemoVB example provided by agrident.So I used a keydown event to invoke the scan which works and it does not matter where the focus is when you press the key ( left and right side )
But I still would like to figure out how to handle the scanner events as we've been discussing.
Regards, Bill
PS I won't be back to this until tomorrow now.