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.
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 Implement VB.NET QR-Code Barcode Reading Library
In your VB.NET project, add BarcodeLib.BarcodeReader.dll to project reference.
How to Decode QR-Code Barcodes Using Free VB.NET Code
It's an easy task to use Visual Basic.NET code to scan QR Code barcodes from a image file. One line free VB code can achieve this.
Dim datas() AsString = BarcodeReader.read("c:/qrcode-vbnet.gif", BarcodeReader.QRCODE)
With this simple VB code, you can read and output all QR Code barcodes data in "qrcode-vbnet.gif" image file at a time.
How to Imporve QR Code Barcode Reading Using Free VB.NET Code
To optimize QR Code barcode reading effect & speed with our VB.NET Barcode Reader DLL, please do as follows. It is suitable to be adopted especially when the source image file is in a large size, like 4mb per image.
1. Scan the Maximum One QR Code Barcode from Image File
If you want to scan the maximum one QR Code in your image source (per image, page in tiff or pdf document), you may set maxOneBarcodePerPage to true.
In this condition, our VB.NET Barcode Recognition Control will stop decode the QR Code as soon as it detects one barcode.
If this property is the default value "false", our our VB.NET Barcode Recognition Control will use total 5 algorithms and each will decode the whole source file from 4 directions.
2. Scan the Partial Image of a Source File
If your QR Code barcode is always at specific area in image source file, you can directly recognize that area only. In this way, you may save a lot of scanning time, CPU and memory usage.
Please specify the left top point and right bottom point of the specific area (the point X, Y values are expressed in percentage of the whole image, so image most left top point is (0%, 0%), and most right bottom point is (100%, 100%).
We provide sample VB.NET Code for this type reading and take top 20% and bottom 20% of the image as an example.
Dim setting As OptimizeSetting = New OptimizeSetting()
setting.setMaxOneBarcodePerPage(True)
Dim top20 As ScanArea = New ScanArea(New Drawing.PointF(0.0F, 0.0F), New Drawing.PointF(100.0F, 20.0F))
Dim bottom20 As ScanArea = New ScanArea(New Drawing.PointF(0.0F, 80.0F), New Drawing.PointF(100.0F, 100.0F))
Dim areas As List(Of ScanArea) = New List(Of ScanArea) areas.Add(top20) areas.Add(bottom20)
setting.setAreas(areas)
Dim datas() AsString = BarcodeReader.read("c:/qrcode-vbnet.gif", BarcodeReader.QRCODE, setting)
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.
Supported Character Sets & Data Formats:
The library supports processing the following formats from scanned QR Codes:
ASCII text: 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 BarcodeScanner.Scan() to decode the QR Code image.
Check if valid barcode results are returned.
Iterate through the scanned text messages.
Replace non-printable carriage return characters (\r) with a visible label [CR].
Output both raw and formatted text values.
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.
Call BarcodeScanner.ScanInDetails() to read the QR Code image.
Use GetDataBytes() to retrieve raw binary data from the barcode.
Decode the byte array using System.Text.Encoding.UTF8.
Output the readable Unicode text result.
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 BarcodeScanner.ScanInDetails() to load and scan the GS1 QR Code image.
Check the IsGS1Compatible property to verify GS1 compliance.
Use the GetMessage() method to retrieve formatted GS1 text.
Split the result to extract individual AI and data pairs.
Output structured GS1 elements for further processing.
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.
Use the dedicated method BarcodeScanner.ScanSingleBarcode().
Pass the image path and set the barcode type to BarcodeType.QRCode.
The scanner stops automatically after detecting the first QR Code.
Return the decoded barcode text as a string array.
Scan Multiple QR Codes with Other Barcode Formats
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. You can also use BarcodeType.All to enable full library support. Scan specific barcode formats from one image for efficiency and accuracy.
Call the BarcodeScanner.ScanInDetails() method to load the image and start decoding.
Pass a custom list of required barcode types as the scanning parameter.
The library automatically identifies and decodes all matching barcodes in the image.
Retrieve complete barcode metadata via the BarcodeDetail array.
Scan Image Regions to Read QR Codes
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 multiple barcodes within predefined regions using ScanRegions().
Create a list of SRegion objects to define scanning areas.
Add region coordinates (X, Y, Width, Height).
Call BarcodeScanner.ScanRegions() with the image path, barcode type, and region list.
Retrieve all detected barcodes as a string array.
Summary
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.
How to Read Other Linear & 2D Barcodes Using VB.NET Code