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 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
We will explain how to scan QR Code (2D matrix barcode) images and process ASCII text (American Standard Code for Information Interchange, including printable and non-printable characters) using VB.NET.
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.
' Scan QR Code and get ASCII text results
Dim result As String() = BarcodeScanner.Scan(
"C:\Input\qrcode-ascii-sample.png", BarcodeType.QRCode)
' Check if any QR Code is detected
If result.Length > 0 Then
' Process each scanned message
For Each msg As String In result
Debug.WriteLine("QR Code Raw Message: '" & msg & "'")
' Replace carriage return non-printable character with [CR] label
Dim tmp As String = msg.Replace(vbCr, "[CR]")
Debug.WriteLine("QR Code ASCII Text: '" & tmp & "'")
Next
Else
Debug.WriteLine("No QR Code Scanned!")
End If
Unicode text
QR Code supports Unicode text encoding. Most barcode generators and printers convert Unicode text to binary data. They 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.
' Scan QR Code and retrieve detailed barcode information
Dim datas As BarcodeDetail() = BarcodeScanner.ScanInDetails(
"C:\Input\qrcode-unicode.png", BarcodeType.QRCode)
' Loop through all scanned barcode results
For j As Integer = 0 To datas.Length - 1
' Decode binary data to Unicode text using UTF8 encoding
Dim textMsgDecoded As String = System.Text.Encoding.UTF8.GetString(datas(j).GetDataBytes())
' Output decoded Unicode text
Console.WriteLine("Unicode text: " & textMsgDecoded)
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, standard GS1 identification code) and corresponding data.
It may also include control characters like the Function 1 Symbol Character (FNC1).
The 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.
' Scan GS1 QR Code and get detailed barcode information
Dim result As BarcodeDetail() = BarcodeScanner.ScanInDetails(
"C:\Input\qrcode-gs1-data.png", BarcodeType.QRCode)
' Iterate all scanned barcode results
For Each b As BarcodeDetail In result
' Check if the barcode conforms to the GS1 standard
If b.IsGS1Compatible Then
' Get formatted GS1 message (Example: (415)5412345678908(3911)710125)
Dim msg As String = b.GetMessage()
' Output raw barcode data and formatted message
Console.WriteLine("Raw Data: '{0}'", b.Data)
Console.WriteLine("Text Message: {0}", msg)
' Split AI and data pairs using ( and ) delimiters
Dim vals As String() = msg.Split({"("c, ")"c}, StringSplitOptions.RemoveEmptyEntries)
' Extract and display AI and corresponding data in pairs
For i As Integer = 0 To vals.Length - 1 Step 2
Console.WriteLine("AI: {0}", vals(i))
Console.WriteLine("Data: {0}", vals(i + 1))
Next
End If
Next
How to read QR Code on desktop?
You can use barcode scanner software installed on computer or barcode scanner device to read and extract QR Code from image.
OnBarcode VB.net QR Code Reader library supports building Windows application with QR Code scanning and reading functions with few lines of Visual Basic source codes.
How to read a QR code that's on your screen?
To read a QR Code on your screen, try the following steps
- Take and save the screenshot of the QR Code image on the computer
- Use QR Code scanner software to read the QR Code from the image
VB.NET QRCode Reader library supports Visual Basic developers quickly to build a Windows (WinForms, WPF, or Console) application with QR Code decoder features integrated.
How do I scan a QR code with my phone?
You can download and install QR Code Scanner app on the iPhone or Android phones. OnBarcode VB.NET QR Code Scanner library supports building Xamarin application for iOS and Adroid with
QR Code reading functions.
How do you scan a QR code from an image?
Online QR Code decoder, QR Code Scanner software allow you to scan and extract a QR Code from an images.
Using OnBarcode QR Code Reader VB.NET SDK, you can quickly build online QR Code scanner based on Windows QR Code Scanner software using WinForms or WPF framework using VB.
Is there a scanner or reader for QR codes?
You can use iPhone and Android phone build-in QR Code Scanner app to read the QR Codes. If you are VB.NET developer, you can easily
build app for iOS and Android with QR Code Reader embed using VB.NET Barcode Reader library with Xamarin.