BarcodeReader.GetPortInfo Method

Gets all port information for the computer.

Namespace: Honeywell.Mobility.DataCollection

Assembly: Honeywell.Mobility.DataCollection.FF3.5 (in Honeywell.Mobility.DataCollection.FF3.5.dll)

[C#]
public void GetPortInfo( BarcodeReader.PortInfo[] myPortInfo )
[Visual Basic (Declaration)]
Public Sub GetPortInfo ( _ myPortInfo As BarcodeReader.PortInfo() _ )

Parameters

myPortInfo
Type: Honeywell.Mobility.DataCollection.BarcodeReader.PortInfo[]
A BarcodeReader.PortInfo struct that stores port data.

Remarks

When you create an instance of the BarcodeReader class, you also create a PortInfoArray of PortInfo struct.

Examples

[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();
                bcr.GetPortInfo(bcr.PortInfoArray);
                for (int i = 0; i < bcr.PortInfoArray.Length; i++)
                {
                    this.listBox1.Items.Add("portID = " + bcr.PortInfoArray[i].PortId);
                    this.listBox1.Items.Add("DeviceType = " + bcr.PortInfoArray[i].PortDeviceType);
                    this.listBox1.Items.Add("PortName = " + bcr.PortInfoArray[i].PortName);
                    this.listBox1.Items.Add("StateID = " + bcr.PortInfoArray[i].PortStateId);
                    this.listBox1.Items.Add("PortStateName = " + bcr.PortInfoArray[i].PortStateName);
                }
            }

            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 BarcodeReader()
            bcr.GetPortInfo(bcr.PortInfoArray)

            For Each myPort As BarcodeReader.PortInfo In bcr.PortInfoArray
                ListBox1.Items.Add("portID = " + myPort.PortId.ToString())
                ListBox1.Items.Add("DeviceType = " + myPort.PortDeviceType)
                ListBox1.Items.Add("PortName = " + myPort.PortName)
                ListBox1.Items.Add("StateID = " + myPort.PortStateId.ToString())
                ListBox1.Items.Add("PortStateName = " + myPort.PortStateName)
            Next
        Catch bcrexp As BarcodeReaderException
            MessageBox.Show(bcrexp.Message)
        End Try
    End Sub
End Class

Exceptions

BarcodeReaderException throws an exception when an error has occurred on bar code read methods and properties.

More Information

BarcodeReader Class