VB.NET Data Matrix Reader & Scanner SDK


How to scan, read Data Matrix barcode images in Visual Basic .NET Windows application?

How to read, scan, decode Data Matrix images in VB.NET class, ASP.NET Web & Windows applications

  • Scan Data Matrix and GS1 Data Matrix barcode in VB.NET class, Console applications
  • Read Data Matrix barcode in VB.NET ASP.NET web projects
  • Read, decode Data Matrix images in Visual Studio VB.NET Windows Forms applications
  • Easy and simple to integrate Data Matrix reader component (single dll file) into your VB.NET project
  • Complete developed in C# 2005, for .net framework 2.0 and later version
  • Detailed tutorials on read barcode in asp.net core c#, read barcode in c# windows application
  • Scanning, decoding Data Matrix from multiple image formats, like BMP, GIF, JPEG, PNG, TIFF formats
  • Scanning, reading Data Matrix from multi-page TIFF documents


How to read, scan Data Matrix 2d barcode image in VB.NET application

  1. Download .NET Data Matrix Barcode Reader Library
  2. Install VB.NET library to scan Data Matrix images in VB.NET apps
  3. Step by Step Tutorial












Scan, Read Data Matrix barcodes from images is one of the barcode reading functions in .NET Barcode Reader SDK control. It is compatible for Microsoft Visual Studio .NET framework 2.0 and later version. VB.NET barcode scanner is a robust and mature .net barcode recognition component for VB.NET projects. You can easily scan and decode linear, 2d barcodes from image documents in your VB.NET class, console application, ASP.NET web projects, and VB.NET Windows software.
To help .net developers easiy integrate barcode reader control into your .net projects, we provide detailed online tutorial for
VB.NET Barcode Reader component supports scanning and reading 20+ linear, 2d barcodes, including
You may also be interested in:


Quick to Read Data Matrix in VB.NET WinForms, WPF application

Here we will learn how to scan and recognize Data Matrix barcodes using the VB.NET Barcode Reader library. It supports both image file paths and Stream (byte-based data transport object) inputs, and is fully compatible with VB.NET, Windows Forms and WPF applications.

You can perform barcode recognition by calling the BarcodeScanner.Scan() method. This method accepts a local image file path or a Stream object, together with the target barcode type as parameters.

  1. Call the core scanning method BarcodeScanner.Scan().
  2. Pass the barcode image source (file path or Stream).
  3. Specify the barcode format as BarcodeType.DataMatrix (2D matrix barcode format).
  4. The method returns a string array containing all decoded Data Matrix data.

Dim datas As String() = BarcodeScanner.Scan(
    "data-matrix-image.gif", BarcodeType.DataMatrix)





Read Scanned Data Matrix Information in VB.NET

Now we will explain how to retrieve advanced Data Matrix (2D matrix barcode symbology) properties from the BarcodeDetail (barcode metadata entity) object in VB.NET desktop applications.

After scanning barcodes and obtaining the BarcodeDetail object, you can use the GetBarcodeProps() method to obtain extended Data Matrix barcode properties stored in DataMatrixProps object. These properties provide detailed encoding and structural information.

  • FormatMode: Gets the Data Matrix format mode used for barcode encoding.
  • DataMode: Gets the Data Matrix encoding data mode. Returns DataMatrixDataMode.Mix if multiple modes are used.
  • IsStructuredAppend: Indicates whether the Data Matrix barcode uses Structured Append mode.
  • SymbolPosition: Gets the position index of the barcode in Structured Append mode (starting at 1).
  • SymbolCount: Gets the total number of barcode symbols in the Structured Append group.
  • FileID: Gets the 2-codeword file identifier (value range: 1 to 254) in Structured Append mode.

The VB.NET example codes explain how to extract the scanned Data Matrix metadata information.

  1. Initialize ScanOptions (scanning configuration class) and set the barcode type to Data Matrix.
  2. Call BarcodeScanner.Scan() to obtain the BarcodeDetail array.
  3. Check for valid scan results.
  4. Traverse the results and use GetBarcodeProps() to get DataMatrixProps (Data Matrix extended property class).
  5. Read and output all Data Matrix specific properties.

' Initialize scanning configuration for Data Matrix barcode
Dim scanOps As New ScanOptions(BarcodeType.DataMatrix)
' Execute barcode scanning
Dim scanResult As BarcodeDetail() = BarcodeScanner.Scan(imgFilePath, scanOps)

' Check if valid barcode results are returned
If scanResult IsNot Nothing AndAlso scanResult.Length > 0 Then
    ' Iterate all scanned barcode records
    For Each barcode As BarcodeDetail In scanResult
        ' Output barcode content message
        Console.WriteLine("Message: {0}", barcode.GetMessage())

        ' Check if the barcode type is Data Matrix
        If barcode.Type = BarcodeType.DataMatrix Then
            ' Get Data Matrix extended properties
            Dim dataMatrixProps As DataMatrixProps = CType(barcode.GetBarcodeProps(), DataMatrixProps)

            ' Output basic encoding properties
            Console.WriteLine("Format Mode: {0}", dataMatrixProps.FormatMode.ToString())
            Console.WriteLine("Data Mode:   {0}", dataMatrixProps.DataMode.ToString())
            Console.WriteLine("Is Structure Append: {0}", dataMatrixProps.IsStructuredAppend)

            ' Read Structured Append properties if enabled
            If dataMatrixProps.IsStructuredAppend Then
                Console.WriteLine("Symbol Position:     {0}", dataMatrixProps.SymbolPosition)
                Console.WriteLine("Symbol Count:        {0}", dataMatrixProps.SymbolCount)
                Console.WriteLine("File ID:             {0},{1}", dataMatrixProps.FileID(0), dataMatrixProps.FileID(1))
            End If
        End If
    Next
End If




How to decode and parse scanned Data Matrix data in VB.NET?

Here we will explain supported data encoding types for Data Matrix (ISO & GS1 compliant 2D barcode) and demonstrates how to scan and parse Data Matrix barcode values using VB.NET.

Data Matrix barcodes following ISO (International Organization for Standardization) and GS1 (Global Standard 1, supply chain barcode standard) support multiple data encoding formats.

Supported Encoding Categories

  1. ASCII Characters
    Includes digits (0-9), uppercase letters (A-Z), lowercase letters (a-z). Also includes special characters and control characters.
  2. Unicode Text
    Supports multi-language text and universal character encoding.
  3. Binary Data
    Stores compressed information and database-derived data.
  4. GS1 Data Message
    Contains one or more combinations of GS1 Application Identifier (AI) and corresponding data.




Scan and parse ASCII chars from Data Matrix

The VB.NET Barcode Reader library supports decoding ASCII data from Data Matrix barcodes.

You can retrieve full ASCII text by using the GetASCIITextMessage() method from the BarcodeDetail class.
  1. Call BarcodeScanner.ScanInDetails() to scan the Data Matrix barcode image.
  2. Obtain the BarcodeDetail array that stores full Data Matrix barcode information.
  3. Iterate through the result array.
  4. Invoke GetASCIITextMessage() to extract ASCII data (including both printable and non-printable characters).

' Scan Data Matrix barcode and return detailed barcode information
Dim barcodeDatas As BarcodeDetail() = BarcodeScanner.ScanInDetails(
    "C:\Input\data-matrix-demo.png", BarcodeType.DataMatrix)

' Iterate all barcode results and output ASCII text
For Each barcodeObj As BarcodeDetail In barcodeDatas
    ' Extract and print ASCII text message
    Debug.WriteLine("Barcode Text: " & barcodeObj.GetASCIITextMessage())
Next




Scan and parse Unicode text from Data Matrix

After retrieving barcode information via the BarcodeDetail (barcode metadata entity) object, you can extract Unicode text with a structured workflow.

Most Unicode-based Data Matrix barcodes use UTF8 encoding for text storage.

  1. Call BarcodeScanner.ScanInDetails() to read the Data Matrix barcode image.
  2. Use the GetDataBytes() method to retrieve raw binary data from the barcode.
  3. Convert the byte array to a readable string using UTF8 encoding.
  4. Output the decoded Unicode text message.

' Scan Data Matrix barcode and get detailed barcode information
Dim barcodeDatas As BarcodeDetail() = BarcodeScanner.ScanInDetails(
    "data-matrix-unicode-demo.png", BarcodeType.DataMatrix)

' Loop through all scanned barcode results
For j As Integer = 0 To barcodeDatas.Length - 1
    ' Get raw binary data from the barcode
    Dim dataInBytes As Byte() = barcodeDatas(j).GetDataBytes()
    
    ' Convert byte array to UTF8 Unicode string
    Dim textMsgDecoded As String = System.Text.Encoding.UTF8.GetString(dataInBytes)
    
    ' Output the decoded message
    Console.WriteLine("message: " & textMsgDecoded)
Next





Scan and parse binary data from Data Matrix

You can extract raw binary data (raw byte-format data stored in 2D barcodes) directly from the scanned barcode result.

Use the GetDataBytes() method provided by the BarcodeDetail class. This method returns a byte array containing the original raw data from the Data Matrix barcode.

  1. Call BarcodeScanner.ScanInDetails() to scan the Data Matrix barcode image.
  2. Obtain the BarcodeDetail array that stores complete barcode information.
  3. Traverse the result array using a loop structure.
  4. Invoke the GetDataBytes() method to get raw binary byte array data.

' Scan Data Matrix barcode and return detailed barcode information
Dim barcodeDatas As BarcodeDetail() = BarcodeScanner.ScanInDetails(
    "data-matrix-unicode-demo.png", BarcodeType.DataMatrix)

' Iterate all barcode results and extract binary data
For j As Integer = 0 To barcodeDatas.Length - 1
    ' Extract raw binary data from barcode detail object
    Dim dataInBytes As Byte() = barcodeDatas(j).GetDataBytes()
Next




Scan and parse GS1 text message from Data Matrix

To extract GS1 data correctly, you must enable GS1 parsing in the scanning configuration.The VB.NET Barcode Reader library automatically parses raw barcode data into structured GS1 format when enabled.

  1. Create a ScanOptions (scanning configuration class) object and set the barcode type to DataMatrix.
  2. Set the EnableGS1 property to True to activate GS1 data parsing.
  3. Call BarcodeScanner.Scan() to process the barcode image.
  4. Check the IsGS1Compatible property to verify GS1 compliance.
  5. Use the GetMessage() method to retrieve the formatted GS1 data string.

' Execute barcode scanning with GS1 enabled
Dim result As BarcodeDetail() = BarcodeScanner.Scan("data-matrix-gs1-sample.png", opts)

' Iterate all scanned barcode results
For Each b As BarcodeDetail In result
    ' Check if the barcode supports GS1 standard
    If b.IsGS1Compatible Then
        ' Get formatted GS1 data message
        ' Example output: (415)5412345678908(3911)710125
        Dim msg As String = b.GetMessage()
        
        ' Output GS1 raw data and formatted message
        Console.WriteLine("Data: '{0}'", b.Data)
        Console.WriteLine("Message: {0}", msg)
    End If
Next












Common Asked Questions

What is a data matrix code?

A data matrix code is a 2-dimensional code that is made of black and white cells that are usually arranged in a square pattern. Using VB.NET barcode scanner library, you will quickly read, scan, and decode Data Matrix code from barcode image files in Visual Basic class, console app, Windows Forms, WPF applications.

What is the ISO standard for Data Matrix?

Data Matrix ISO specification is ISO/IEC 16022, and the latest standard version is ISO/IEC 16022:2024. VB.NET Barcode Reader library will scan and recognize Data Matrix barcode codes from image files in VB.NET console and Windows applications using Visual Studio .NET IDE.

Can you scan a Data Matrix?

Yes. You can use your smartphone (iPhone or Android phone) installed app to scan and decode the Data Matrix code from images. If you are a visual basic developer, you can use OnBarcode VB.NET barcode decoder library to build a Windows app to scan and recognize Data Matrix code from barcode images.

Can a Data Matrix be damaged?

Yes. a Data Matrix barcode can be damaged. Data Matrix (ECC200) is using the Reed-Solomon algorithm for error correction. A ECC200 Data Matrix barcode image can still be decodable when upto 50% of the Data Matrix bar modules are damaged. Using OnBarcode VB.NET Barcode Scanner library, you can easily scan and read Data Matrix text from a damaged Data Matrix barcode image in VB.NET app.

How to scan GS1 data information from Data Matrix?

Data Matrix barcode supports GS1 System. The Data Matrix with GS1 data encoded should follow the GS1 stanadard. OnBarcode VB.NET Barcode Reader library supports scan and read GS1 data text from Data Matrix images in Visual Basic WPF, Windows Forms, Console projects.




































Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.