How to Use VB.NET Code to Decode QR Code Barcodes for .NET Applications
Use professional VB.NET QR Code barcode reading & recognition library DLL
With easy-to-use design, no need for license key or registration code
Read and decode QR Code for VB.NET Windows, ASP.NET Web, and .NET Class Library projects
Read and output QR Code 2d barcodes data from image source file in high speed
Scan all QR Code barcodes or a maximum one QR Code barcode form several image file formats
Reliable VB.NET Barcode Reading Library in the market with best recognition performance
This document provides a technical guide for scanning and reading QR Code barcode images in Visual Basic .NET Windows applications, including Windows Forms and WPF.
VB.NET QR Code Reader Library
QR Code, Data Matrix, Code 128, GS1, EAN/UPC. Multi-thread reading in VB.NET Windows Forms, WPF application.
Scanning and reading QR Code barcodes from images is a core function of the BarcodeLib .NET Barcode Reader SDK control. It is compatible with Microsoft Visual Studio .NET Framework 2.0 and later versions. The BarcodeLib VB.NET barcode scanner is a robust and mature .NET barcode recognition component for VB.NET projects. You can easily scan and decode linear and 2D barcodes from image documents in your VB.NET class, console application, ASP.NET web projects, and VB.NET Windows software (including WinForms and WPF).
How to Scan, Read QR Code in VB.NET?
You can quickly scan and read QR Codes from an image file in VB.NET.
Create an instance of OptimizeSetting configured for QR Code decoding. This tells the barcode reader to optimize the recognition process specifically for QR codes.
Read all QR Codes from the specified image file using the optimization settings. The method returns an array of BarCode objects found in the image.
Iterate through each detected QR Code in the result array. Retrieve the decoded text message from the current QR Code.
DimoptionsAsNewOptimizeSetting(BarcodeReader.QRCODE)
DimbarcodesAsBarCode() =BarcodeReader.ReadBarcode("qrcode-image.png", options)
ForEachbarcodeAsBarCodeInbarcodesDimbarcodeTextAsString=barcode.GetMessage()
Next
Scan QR Code from Stream, byte array, Bitmap object in memory
You can also read, scan QR Codes directly from Stream, byte array and Bitmap object in Visual Basic program.
Read the entire image file into a byte array.
Create a memory stream from the byte array to provide a seekable stream for QR Code reading.
Read all QR Codes from the Stream using the specified optimization settings.
The VB.NET Barcode Scanner SDK will automatically read and recognize all kinds of valid QR Code, including colored QR Code, GS1 QR Code, rotated QR Code,
QR Code with logo image.
Scan QR Code and other barcode types in VB.NET
You can specify and scan QR Code with other barcode types at the same time from a single image file using VB.NET Barcode Generator library.
How to read scanned QR Code information in VB.NET?
Using BarcodeLib VB.NET Barcode Reader library, you can also read scanned QR Code barcode information, including
QR Code location, QR Code standard (ISO or GS1), QR Code encoding mode, error correction level, and other useful information.
You can view more detaisl here: Scanning and Reading All QR Code Information in C#.
Process Scanned QR Code Data Message in VB.NET Windows Applications
QR Code supports a wide range of character sets and industry-standard data structures. The BarcodeLib VB.NET Barcode Reader library provides dedicated methods to parse and process these complex data types. You can use built-in functions to handle multiple encoding formats efficiently.
The barcode library supports processing the following character sets & data formats from scanned QR Codes:
Plain English text (ASCII chars): Includes both printable and non-printable characters.
Unicode text: Supports multi-language and universal character encoding.
Binary data: Supports raw byte data for files, streams, and custom payloads.
GS1 data elements: Supports industry-standard GS1-compliant barcode messages.
ASCII Text Characters
This section explains how to scan QR Code images and process ASCII text (including printable and non-printable characters) using VB.NET.
The full ASCII text table consists of 128 standard characters. The first 32 characters and the final character are non-printable control characters. One common example is the carriage return control character.
You can scan QR Codes and format non-printable ASCII characters into readable labels in VB.NET applications.
Call BarcodeReader.ReadBarcode() to decode the QR Code image.
Iterate through the scanned QR Code text messages using method GetMessageInASCII().
DimoptionsAsNewOptimizeSetting(BarcodeReader.QRCODE)
DimbarcodesAsBarCode() =BarcodeReader.ReadBarcode("qrcode-ascii-text.png", options)
ForEachbarcodeAsBarCodeInbarcodesDimbarcodeTextAsString=barcode.GetMessageInASCII()
Next
Unicode Text
QR Code supports Unicode text encoding. Most barcode generators and printers convert Unicode text to binary data, then encode the binary data using QR Code binary mode.
To decode Unicode text correctly, you must use the matching encoding format. UTF8 encoding is the most common standard for Unicode QR Codes.
You can extract and decode Unicode text from QR Code using UTF8 encoding in VB.NET.
Use BarcodeReader.ReadBarcode() to recognize the QR Code image.
Iterate through the scanned QR Code text messages using method GetMessage().
The library will decode the byte array using System.Text.Encoding.UTF8, and output the readable Unicode text result.
DimoptionsAsNewOptimizeSetting(BarcodeReader.QRCODE)
DimbarcodesAsBarCode() =BarcodeReader.ReadBarcode("qrcode-unicode-text.png", options)
ForEachbarcodeAsBarCodeInbarcodesDimbarcodeTextAsString=barcode.GetMessage()
Next
GS1 Data Message
The GS1 System uses QR Code as a common data carrier. A GS1-encoded QR Code contains pairs of AI (Application Identifier) and corresponding data. It may also include control characters like the Function 1 Symbol Character (FNC1).
The BarcodeLib VB.NET Barcode Reader library automatically parses GS1 messages. You can directly read formatted GS1 data elements without handling low-level control characters.
Follow these steps to implement GS1 QR Code scanning and parsing in VB.NET:
Call BarcodeReader.ReadBarcode() to get all scanned and valid QR Code data in BarCode objects
Check the IsGS1Compitable property to verify GS1 compliance.
Use the GetMessage() method to retrieve formatted GS1 text message.
DimoptionsAsNewOptimizeSetting(BarcodeReader.QRCODE)
DimdatasAsBarCode() =BarcodeReader.ReadBarcode("gs1-qrcode-sample.png", options)
ForEachdataAsBarCodeIndatasIfdata.IsGS1CompitableThen' Get message in string format.' Eg. "(415)5412345678908(3911)710125"DimmsgAsString=data.GetMessage()
EndIfNext
How to Improve QR Code Image Reading Performance in VB.NET Windows Application
The BarcodeLib VB.NET Barcode Reader library offers multiple optimized methods to improve scanning efficiency. These features reduce processing time and enhance responsiveness in desktop applications (WinForms and WPF).
Single QR Code Quick Scan: When enabled, the library stops scanning immediately after detecting the first valid QR Code. This eliminates unnecessary full-image processing.
Concurrent Multi-Type Barcode Scanning: Supports scanning QR Code and other barcode symbologies in a single operation.
Specified Region Scanning: Restricts scanning to defined rectangular areas of the image. This reduces the total pixel data that must be processed.
Scan a Single QR Code
The BarcodeLib VB.NET Barcode Reader library provides an optimized fast-scan feature. When enabled, the scanning process stops immediately after detecting a valid QR Code. This greatly reduces unnecessary processing and improves decoding speed. This function is highly efficient for images that contain only one QR Code symbol.
In OptimizeSetting object, call method setMaxOneBarcodePerPage(true) to enable single QR Code scanning.
The scanner stops automatically after detecting the first QR Code.
The BarcodeLib VB.NET Barcode Reader library supports scanning multiple barcode types in one operation. You can scan custom selected formats or all supported formats in a single pass. Scan specific multiple barcode formats from one image for efficiency and accuracy.
Provide list of the specified barcode types to the OptimizeSetting object
The barcode library automatically identifies and decodes all matching barcodes in the image.
You can define rectangular areas inside an image to limit the scanning scope. This improves reading speed and reduces decoding errors. The barcode library only processes the specified regions instead of the full image. This optimization works for QR Code and all other supported barcode symbologies.
The following VB.NET code scans QR Codes within predefined regions in OptimizeSetting.
Create a list of ScanArea objects to define scanning areas inside the image.
Add interested region coordinates (X, Y, Width, Height).
DimoptionsAsNewOptimizeSetting(BarcodeReader.QRCODE)
DimareasAsNewList(OfScanArea) From {
NewScanArea(NewPointF(0, 0), NewPointF(50, 60))
}
options.setAreas(areas)
This page has covered the essential methods for integrating QR Code barcode reading into VB.NET applications, with specific attention to Windows Forms and WPF environments. The BarcodeLib library provides robust support for ASCII, Unicode, binary, and GS1 data extraction, as well as performance optimization techniques such as single barcode scanning, multi format scanning, and region restricted scanning. For further details on other barcode symbologies or advanced features, refer to the additional documentation and tutorials referenced above.