BarcodeReader.Dispose Method

Releases all resources from the scanner. Your application must call Dispose before exiting, or the application may not exit properly.

Namespace: Honeywell.Mobility.DataCollection

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

[C#]
public void Dispose()
[Visual Basic (Declaration)]
Public Sub Dispose

Parameters

None.

Remarks

Multiple simultaneous instances of this class are not supported. Before you create a new instance, call Dispose to dispose of the existing instance.

Examples

[C#]
using Honeywell.Mobility.DataCollection;
namespace BarcodeReader
{
    public partial class frmBarcodeReader : Form      
    {
        private Honeywell.Mobility.DataCollection.BarcodeReader bcr;

        public frmBarcodeReader()
        {
            InitializeComponent();

            try
            {
                bcr = new Honeywell.Mobility.DataCollection.BarcodeReader();
            }
            catch (BarcodeReaderException bcrexp)
            {
                MessageBox.Show(bcrexp.Message);
            }
        }
 
        private void menuExit_Click(object sender, EventArgs e)
        {
            if (bcr != null)
            {
                bcr.Dispose();
                bcr = null;
            }

            Application.Exit();
        }
    }
}
[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()
        Catch bcrexp As BarcodeReaderException
            MessageBox.Show(bcrexp.Message)
        End Try
    End Sub

    Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
        If bcr Is Nothing Then
            'do nothing
        Else
            bcr.Dispose()
        End If

        Application.Exit()
    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