private void Reader_OnBarCodeRead(object sender, BarCodeReader.BarCodeReadEventArgs e) { InventoryService iService = new InventoryService(_context); Regex reg = null; reg = new System.Text.RegularExpressions.Regex("^[1-9][0-9]*$"); foundBarCode = string.Empty; Invoke(new MethodInvoker(() => { txtScannerOutput.Text = e.ValueRead.ToString(); })); Invoke(new MethodInvoker(() => { foundBarCode = e.ValueRead.ToString(); })); if (txtScannerOutput.Text != string.Empty) { if (selectedPart != null && _scanType == ScanType.associate) { partsService.AssociateSKU(selectedPart, foundBarCode); var _part = partsService.Find(selectedPart.PartID); if (_part.Sku == foundBarCode) { MessageBox.Show("Success Associating SKU to Part"); Invoke(new MethodInvoker(() => { this.txtPartSearch.Text = " "; })); } return; } else if (_scanType == ScanType.find) { Part partlookup = partsService.FindBySKU(foundBarCode); if (!String.IsNullOrEmpty(partlookup.Sku)) { reader.CloseScanner(); Invoke(new MethodInvoker(() => { OpenPartDetailForm(partlookup.PartID, _context);; })); } } } }