Quick to scan Code 39 barcodes in VB.NET WinForms, WPF application
Here we will demonstrate how to scan and recognize Code 39 (linear 1D barcode symbology) using the VB.NET Barcode Reader library.
You can implement Code 39 barcode scanning with a direct method call in VB.NET. The core scanning method accepts an image path and target barcode type as input parameters.
You can implement Code 39 barcode scanning with a direct method call in VB.NET. The core scanning method accepts an image path and target barcode type as input parameters.
- Call the core decoding method
BarcodeScanner.Scan(). - Pass the barcode image file path as the first parameter.
- Specify the barcode type as
BarcodeType.Code39. - The method returns a string array containing all decoded barcode data.
' Scan and decode Code 39 barcode from image file Dim datas As String() = BarcodeScanner.Scan("code-39-barcode-image.gif", BarcodeType.Code39)
Note: This method supports common image formats (GIF, PNG, JPG) in VB.NET desktop applications.
Scan Code 39 with checksum
The ISO standards for Code 39 and Code 39 Extension do not specify mandatory checksum rules.
If your barcode includes a checksum digit, you must enable checksum validation manually.
The library will verify data integrity and return clean data without the checksum.
Follow these steps to validate Code 39 checksum in VB.NET:
If your barcode includes a checksum digit, you must enable checksum validation manually.
The library will verify data integrity and return clean data without the checksum.
Follow these steps to validate Code 39 checksum in VB.NET:
- Create a
ScanOptionsfor Code 39. - Set
Code39WithCheckCharacter = Trueto enable checksum verification. - Scan the image using
BarcodeScanner.Scan(). - Check for valid barcode results.
- Get clean decoded data using
GetMessage(). - Cast to
Code39Propsand read the checksum value if available.
' Create scanning configuration for Code 39 Dim ops As New ScanOptions(BarcodeType.Code39) ' Enable checksum validation and processing ops.Code39WithCheckCharacter = True ' Scan the barcode image with enabled checksum verification Dim result As BarcodeDetail() = BarcodeScanner.Scan(imgFilePath, ops) If result IsNot Nothing AndAlso result.Length > 0 Then ' Process each detected barcode For Each b As BarcodeDetail In result Console.WriteLine("Message: {0}", b.GetMessage()) ' Get Code 39 advanced properties Dim props As Code39Props = CType(b.GetBarcodeProps(), Code39Props) If props IsNot Nothing AndAlso props.HasChecksum Then ' Output checksum value and display character Console.WriteLine("Checksum: {0} ('{1}')", props.Checksum, props.ShowChar) Else Console.WriteLine("No Checksum") End If Next Else Console.WriteLine("No Barcode Found") End If
Note:
- You must enable
Code39WithCheckCharactermanually for barcodes with checksums. - The library automatically removes the checksum from the final output data.
- Use high-quality images to ensure reliable checksum detection.
Common Asked Questions
What is Code 39 barcode used for?
Code 39, also known as Code 3 of 9, was the first barcode to encode both numbers and letters. It is most commonly used in
the inventory, government, military and electronics industries.
Using VB.NET barcode reader library, you can easily scan and recognize Code 39 text from barcode images in VB.NET class library, console, WinForms, WPF Windows apps.
What is the Code 39 on a barcode reader?
Code 39 is a 1d barcode symbology that encodes up to 43 characters, including uppercase letters, numbers, and special symbols.
Code 39 extension supports encoding full 128 ASCII characters.
Using VB.NET Barcode Scanner library, you can scan and decode all 128 ASCII characters from Code 39 and Code 39 extension barcode images in VB class in Windows applications.
How to decode Code 39?
To scan and decode Code 39 text from a barcode image, a barcode scanner device or reader software will scan all bar and space modules on the Code 39 barcode symbology,
and use a character map to translate the bar and space groups into Code 39 data characters.
OnBarcode VB.NET Barcode Scanner library will help VB developer quickly integrate Code 39 barcode scanning and reading features in a VB.NET class, WPF, WinForms Windows application.
What is the difference between Code 39 and Code 128 barcodes?
Code 128 requires a checksum. If the Code 128 barcode is damaged, it may still be scannable. Code 39 checksum is optional.
If the Code 39 barcode without checksum is damaged, it won't be scannable.
In VB.NET class, you can scan, recognize and decode both Code 128 and Code 39 barcode data from image files using VB .NET Barcode Reader library.