Common error when using the COM object
We often get emails asking why the ScanBarCode method in the SoftekATL.Barcode OCX object returns the value 0 when it works fine in other interfaces. The reason for this is that in the COM interface the number of barcodes found by the ScanBarCode method is stored in the BarCodeCount property.
For example, the following code is wrong….
oBarcode = New SoftekATL.CBarcode
nBarcodes = oBarcode.ScanBarCode(Path.ToString)
And should look like…oBarcode.ScanBarCode(Path.ToString)
oBarcode = New SoftekATL.CBarcode
oBarcode.ScanBarCode(Path.ToString)
nBarCodes = oBarcode.BarCodeCount
So the solution is simply to use the BarCodeCount property rather than the return code from ScanBarCode.