Reading Barcodes in VB.Net
Using the Softek Barcode Reader SDK to read barcodes from images in a VB.Net project is very straight foward and this article should get you up and running in under 15 minutes…
Download the barcode reader sdk from here
If you are using a 64-bit system and want to handle PDF documents then please run REGISTER.BAT in the x86 folder before you continue.
Open your VB.Net project in Visual Studio or start a Windows Forms Application if you are starting from scratch.
Add a reference to the SoftekBarcodeLib3.dll…
Select Add Reference from the Project menu:
Then browse to the installation folder for the Softek Barcode Reader SDK and open the “anycpu” folder and select SoftekBarcodeLib3.dll:
Take a note of the location of the folder where the SDK is installed (not including the anycpu folder)
In the function where you want to read the value of a barcode from an image add the following code:
Dim barcode As SoftekBarcodeLib3.BarcodeReader Try barcode = New SoftekBarcodeLib3.BarcodeReader("\path\to\the\sdk\installation\folder") Catch ex As System.DllNotFoundException MessageBox.Show("Could not locate the Softek Barcode Reader SDK Installation Folder") Return End Try barcode.MultipleRead = True Dim nBarCodes As Integer nBarCodes = barcode.ScanBarCode("somefile.tif") Dim i As Integer For i = 1 To nBarCodes MessageBox.Show("Found barcode with value " & barcode.GetBarString(i)) Next
That’s it – all done. But don’t forget that there is a lot more to the sdk than just this. If you have any questions then please contact email@example.com . Don’t forget we have lots of sample images under the toolkit installation folder and it’s always a good idea to try these first before your own images.
You also might wish to add some extra lines of code to turn on or off various barcode types and maybe set a license key:
barcode.ReadQRCode = True
barcode.LicenseKey = “MY LICENSE KEY”