private void LoadScanner() { // Initialize the ScanSampleAPI reference. this.barcodeScanner = new BarcodeScanner(); this.isReaderInitiated = this.barcodeScanner.InitReader(); if (!(this.isReaderInitiated))// If the reader has not been initialized { // Display a message & exit the application. //MessageBox.Show("Fail to initialize barcode reader"); frmMessageBox form = new frmMessageBox(MessageTypes.Error, "Fail to initialize barcode reader", "Error"); form.ShowDialog(); Application.Exit(); } else // If the reader has been initialized { // Clear the statusbar where subsequent status information would be displayed. //statusBar.Text = ""; // Attach a status natification handler. this.myReadNotifyHandler = new EventHandler(myReader_ReadNotify); barcodeScanner.AttachReadNotify(myReadNotifyHandler); //this.myStatusNotifyHandler = new EventHandler(myReader_StatusNotify); //barcodeScanner.AttachStatusNotify(myStatusNotifyHandler); this.barcodeScanner.StartRead(false); } }