Overloaded constructor sets the scanner name and buffer size.
Namespace: Honeywell.Mobility.DataCollection
Assembly: Honeywell.Mobility.DataCollection.FF3.5 (in Honeywell.Mobility.DataCollection.FF3.5.dll)
[C#]
public BarcodeReader( string deviceName, uint buffSize )
[Visual Basic (Declaration)]
Public Sub New ( _
deviceName As String, _
buffSize As UInteger _
)
deviceName
Type: System.String
Name of the scanner to be used.
buffSize
Type: System.UInt32
Size in bytes for the buffer (minimum 130 bytes). Although the default size of 2 KB is adequate for most applications, if you are using a bar code symbology that encodes a larger amount of data you should specify a larger buffer size.
Even if your application does not use a form, you need to add a reference to System.Windows.Forms.
Multiple simultaneous instances of this class are NOT supported. Before you create a new instance, call Dispose to dispose of the existing instance.
The BarcodeReader class supports the following scanner names:
[C#] using Honeywell.Mobility.DataCollection; namespace DataCollection { public partial class frmBarcodeReader : Form { private Honeywell.Mobility.DataCollection.BarcodeReader bcr; public frmBarcodeReader() { InitializeComponent(); try { bcr = new Honeywell.Mobility.DataCollection.BarcodeReader("External", 5000); bcr.BarcodeRead += new BarcodeReadEventHandler(bcr1_BarcodeRead); bcr.PostRead = true; } catch (BarcodeReaderException bcrexp) { MessageBox.Show(bcrexp.Message); } } void bcr_BarcodeRead(object sender, Honeywell.Mobility.DataCollection.BarcodeReadEventArgs bre) { try { this.listBox1.Items.Add("strBarcodeData = " + bre.strBarcodeData); this.listBox1.Items.Add("SymbologyId = " + bre.SymbologyId); this.listBox1.Items.Add("SymbologyName = " + bre.SymbologyName); this.listBox1.Items.Add("DataType = " + bre.DataType); this.listBox1.Items.Add("BytesInBuffer = " + bre.BytesInBuffer); this.listBox1.Items.Add("PortID = " + bre.PortID); this.listBox1.Items.Add("PortName = " + bre.PortName); this.listBox1.Items.Add("PortDeviceType = " + bre.PortDeviceType); } catch (BarcodeReaderException bcrexp) { MessageBox.Show(bcrexp.Message); } } } }
[VB.NET] Imports Honeywell.Mobility.DataCollection Public Class BarcodeReader Private WithEvents bcr As Honeywell.Mobility.DataCollection.BarcodeReader Private Sub BarcodeReader_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try bcr = New Honeywell.Mobility.DataCollection.BarcodeReader("External", 5000) bcr.PostRead = True Catch bcrexp As BarcodeReaderException MessageBox.Show(bcrexp.Message) End Try End Sub Private Sub bcr_BarcodeRead(ByVal sender As Object, ByVal bre As Honeywell.Mobility.DataCollection.BarcodeReadEventArgs) Handles bcr.BarcodeRead ListBox1.Items.Add("strBarcodeData = " + bre.strBarcodeData) ListBox1.Items.Add("SymbologyId = " + bre.SymbologyId.ToString()) ListBox1.Items.Add("SymbologyName = " + bre.SymbologyName) ListBox1.Items.Add("DataType = " + bre.DataType) ListBox1.Items.Add("BytesInBuffer = " + bre.BytesInBuffer) ListBox1.Items.Add("PortID = " + bre.PortID.ToString()) ListBox1.Items.Add("PortName = " + bre.PortName) ListBox1.Items.Add("PortDeviceType = " + bre.PortDeviceType) End Sub
End Class
BarcodeReaderException throws an exception when an error has occurred on bar code read methods and properties.