VB.NET Data Matrix Generator Introduction
Data Matrix, also known as Data Matrix ECC200, is great 2-dimensional matrix barcode to store different data up to 2,335 alphanumeric characters.
Using VB.NET Data Matrix Generator to create Data Matrix barcodes in VB.NET program is a simple and easy job. VB.NET Data Matrix Generator control is easy to install with a single .NET Barcode generation control. It is easy to generate Data Matrix barcodes in VB.NET class with detailed VB.NET Data Matrix settings document and complete demo for Data Matrix generation in VB.NET provided in this article.
Data Matrix Generators
OnBarcode provides several Data Matrix Generator components and software, including
.NET Data Matrix,
Java Data Matrix,
C# Data Matrix,
Excel Data Matrix Generator,
Word Data Matrix Generator,
Data Matrix Generator,
ASP.NET Data Matrix.
Quick to Generate Data Matrix using VB.NET codes
Using VB.NET Data Matrix barcode generator sdk, you can easily create and print 2d data matrix barcodes in vb.net class.
- Create a
DataMatrixobject - Input the Data Matrix encoding text to property
Data - Call method
drawBarcode()to print the Data Matrix to an image file
Dim barcode = New DataMatrix() barcode.Data = "Data Matrix" barcode.drawBarcode("C://Output//vb-net-data-matrix-how-to-demo.png")
Create Data Matrix with advanced options using VB.NET
Encode ASCII characters in Data Matrixn using VB.NET
The following VB.NET code snippet is designed to generate a Data Matrix 2D barcode image in Windows Forms or WPF desktop applications. It initializes a Data Matrix barcode object, configures ascii chars encoding properties, sets the barcode data with ASCII control characters, and prints the final barcode to a PNG file on the local filesystem.
- Instantiate a strongly-typed DataMatrix object.
- Enable the tilde character processing feature for the Data Matrix barcode encoder. Allows the barcode library to interpret tilde-prefixed ASCII control codes in the input data string.
- Assign the raw input string "Data~013Matrix" to the barcode's data property for encoding.
The
~013sequence represents an ASCII carriage return control character, processed only when ProcessTilde is enabled. - Save the generated barcode image to the specified absolute file path in the Windows filesystem
Dim barcode = New DataMatrix() barcode.ProcessTilde = True barcode.Data = "Data~013Matrix" barcode.drawBarcode("C://Output//vb-net-data-matrix-ascii-character.png")
Encode Unicode text in Data Matrix using VB.NET
This VB.NET code configures and generates a Data Matrix 2D barcode capable of encoding Unicode text for Windows Forms and WPF desktop applications. It sets a Unicode-compatible data string, enables Unicode encoding functionality, and renders the final barcode as a PNG image file.
- Assign a human-readable Unicode text string to the Data Matrix barcode object's data property.
- Enable the built-in Unicode text encoding feature of the Data Matrix barcode library for .NET desktop applications. This property ensures special characters, non-English text, and multi-byte Unicode symbols are properly encoded in the barcode
Dim barcode = New DataMatrix() barcode.Data = "Data Matrix Unicode text here" barcode.EncodeUnicodeText = True barcode.drawBarcode("C://Output//vb-net-data-matrix-unicode-text.png")
Encode GS1 text message in Data Matrix
The VB.NET code snippet below creates a GS1-compliant Data Matrix 2D barcode for integration in Windows Forms and WPF desktop applications. It defines structured GS1 formatted data, applies the mandatory FNC1 first position identifier, and prints the Data Matrix barcode as a PNG image file.
- Assign a structured GS1 data string to property
Data. - Sets the
FNC1(Function Code 1) property to the first position mode required for valid GS1 Data Matrix barcodes. This configuration enables strict GS1 standard compliance for barcode scanning and decoding in .NET Windows Forms and WPF solutions.
Dim barcode = New DataMatrix() barcode.Data = "(17)050101(10)ABC123" barcode.FNC1 = FNC1.FNC1_1ST_POS barcode.drawBarcode("C://Output//vb-net-data-matrix-gs1-text.png")
Create, customize Data Matrix with specified image size using VB.NET
The following VB.NET code print a Data Matrix 2D barcode with a fixed custom width and height for vb.net applications.
- Configure the fixed pixel width of the Data Matrix barcode to 300 pixels. The barcode generation library automatically sets the barcode height to match the barcode width.
Dim barcode = New DataMatrix() barcode.Data = "Data Matrix" barcode.BarcodeWidth = 300 barcode.drawBarcode("C://Output//vb-net-data-matrix-size.png")
Create Ractangle Data Matrix in VB.NET
This Visual Basic .NET source code below generates a customized rectangular Data Matrix 2D barcode for use in Windows Forms and WPF desktop applications.
It sets the encoded data, applies a fixed rectangular format mode, defines exact width and height dimensions, and exports the final barcode as an image file.
- Sets a fixed rectangular Data Matrix format (16x48) to enforce a specific symbol shape and structure for the barcode.
- Defines the total rendered width of the barcode image as 900 pixels.
- Sets the total rendered height of the barcode image to 300 pixels, maintaining the rectangular aspect ratio.
Dim barcode = New DataMatrix() barcode.Data = "Data Matrix" barcode.FormatMode = DataMatrixFormatMode.Format_16X48 barcode.BarcodeWidth = 900 barcode.BarcodeHeight = 300 barcode.drawBarcode("C://Output//vb-net-data-matrix-size-rectangle.png")
Create Data Matrix with advanced options using VB.NET
Data Matrix Format Mode in Visual Basic
Data Matrix ISO standard specifies 24 square symbols and 6 rectangular symbols available in ECC 200.
Each symbol size includes different rows and columns with different data storage capacity.
Using VB.NET Data Matrix Barcode generation library, you can print and customize Data Matrix barcode with specified size format in vb.net code.
Using VB.NET Data Matrix Barcode generation library, you can print and customize Data Matrix barcode with specified size format in vb.net code.
- Set property
FormatModeto specify the generated Data Matrix size format mode.
barcode.FormatMode = DataMatrixFormatMode.Format_16X16
Data Matrix Structured Append in vb.net
Data Matrix barcode standard provides a mechanism for the data in a file to be split into blocks and be represented in more than one Data Matrix barcode symbols.
The vb.net source codes below explain how to store one message into 3 three Data Matrix barcode images using Visual Basic .NET Barcode Generator library.
The vb.net source codes below explain how to store one message into 3 three Data Matrix barcode images using Visual Basic .NET Barcode Generator library.
- Set property
StructuredAppendto true to enable Data Matrix Structured Append mode - Set property
SymbolCountto specify the total number of Data Matrix barcodes to store the same data message - Set property
SymbolIndexto specify the order of the current data matrix. The first symbol index should be starting with0 - Set property
FileIdwith a random unique integer. All data matrix barcodes to store the same data message should have the sameFileIdvalue.
Dim barcode = New DataMatrix() barcode.Data = "Data Matrix" barcode.StructuredAppend = True barcode.SymbolCount = 3 barcode.SymbolIndex = 0 barcode.FileId = 100 barcode.drawBarcode("C://Output//vb-net-data-matrix-structured-append-demo.png")
Data Matrix FNC1 in VB.NET
When FNC1 appears in the first Data Matrix symbol character position, it shall signal that the Data Matrix encoding data conforms to the GS1 Application Identifier standard format.
To enable this mode using VB.NET Data Matrix barcode generator library, you need apply the following property in the Visual Basic source code.
To enable this mode using VB.NET Data Matrix barcode generator library, you need apply the following property in the Visual Basic source code.
- Set property
FNC1with valueFNC1.FNC1_1ST_POS
barcode.FNC1 = FNC1.FNC1_1ST_POS
Encode Macro (05, 06) character in Data Matrix using VB.NET
This VB.NET code below configures and generates a Data Matrix 2D barcode with Macro Character support.
- Enable the property
ProcessTilde. - Assign an encoded string containing a Macro control character (~m5) and standard text to the barcode data property. The ~m5 sequence is a specialized Data Matrix Macro character used for industrial and standardized encoding.
Dim barcode = New DataMatrix() barcode.ProcessTilde = True barcode.Data = "~m5Data Matrix" barcode.drawBarcode("C://Output//vb-net-data-matrix-macro-character.png")
Encode FNC3 (Reader Programming) character in Data Matrix
The VB example below shows how to insert a embedded Function 3 in order to initiate "Reader Initialization".
- Enable the property
ProcessTilde. - Assign a data string that includes the FNC3 control sequence (~rp) followed by standard text to the barcode object.
The
~rpsequence represents the FNC3 control character used for reader programming in industrial Data Matrix symbology.
Dim barcode = New DataMatrix() barcode.ProcessTilde = True barcode.Data = "~rpData Matrix" barcode.drawBarcode("C://Output//vb-net-data-matrix-fnc3-character.png")
Create Data Matrix Barcodes in VB.NET
Creating Data Matrix barcode in VB.NET class example:
Imports OnBarcode.Barcode
Dim barcode As DataMatrix = New DataMatrix
' Data Matrix Barcode Basic Settings
barcode.Data = "112233445566"
barcode.DataMode = DataMatrixDataMode.ASCII
' if your selected format mode doesnot have enough space to encode your data,
' the library will choose the right format mode for you automatically.
barcode.FormatMode = DataMatrixFormatMode.Format_48X48
' Set the ProcessTilde property to true, if you want use the tilde character "~"
' to specify special characters in the input data. Default is false.
'
' 1) 1-byte character: ~0dd/~1dd/~2dd (character value from 000 ~ 255);
' ASCII character '~' is presented by ~126;Strings from "~256" to "~299" are unused
' modified to FS, GS, RS and US respectively.
' 2) 2-byte character (Unicode): ~6ddddd (character value from 00000 ~ 65535)
' Strings from "~665536" to "~699999" are unused
' 3) for GS1 AI Code:
' ~ai2: AI with 2 digits
' ~ai3: AI with 3 digits
' ~ai4: AI with 4 digits
' ~ai5: AI with 5 digits
' ~ai6: AI with 6 digits
' ~ai7: AI with 7 digits
' 4) ECI: ~7dddddd (valid value of dddddd from 000000 to 999999)
' 5) ~rp: Reader Programming (for ASCII mode and Auto mode only)
' 6) ~m5: 05 Macro (for ASCII mode and Auto mode only)
' 7) ~m6: 06 Macro (for ASCII mode and Auto mode only)
barcode.ProcessTilde = True
' Barcode Size Related Settings
barcode.UOM = UnitOfMeasure.PIXEL
barcode.X = 3
barcode.LeftMargin = 0
barcode.RightMargin = 0
barcode.TopMargin = 0
barcode.BottomMargin = 0
barcode.Resolution = 96
barcode.Rotate = Rotate.Rotate0
' Image format setting
barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Gif()
barcode.drawBarcode("c://data-matrix.gif")
Common Asked Questions
What is a data matrix barcode?
A data matrix barcode is a 2d or matrix barcode symbology that is made of black (bar) and white (space) modules that are usually arranged in a square pattern.
Using OnBarcode VB.NET Barcode Generator library, you can easily create, encode, customize and print Data Matrix barcode images in Visual Basic .NET classes.
What are the different types of Data Matrix?
According to Data Matrix latest ISO standard (ISO/IEC 16022), there are two versions of Data Matrix
- ECC 000-140
- ECC 200
What is the ISO standard for Data Matrix barcode?
Data Matrix ISO specification is ISO/IEC 16022, and the latest standard version is ISO/IEC 16022:2024.
VB.NET Barcode Generator library fully supports ISO compatible Data Matrix generations in Visual Basic .NET class library, console app, Windows Forms, WPF applications.
How much data can a Data Matrix barcode store?
The maximum data storage of Data Matrix is depending on its encoding data formats.
- Alphanumeric data: up to 2,335 characters
- Byte data (8-bit): 1,555 characters
- Numeric data: 3,116 digits
What is the minimum and maximum size of Data Matrix barcode?
The minimum dimension size of Data Matrix is 10 x 10 modules. And the maximum dimension size of Data Matrix is 144 x 144 modules. Each modules are squares.
OnBarcode VB.NET Barcode library supports all formats defined in Data Matrix ISO standard. You can generate and customize the Data Matrix format
in Visual Basic .NET class library, console, WinForms, WPF windows applications.
What is the difference between Data Matrix and QR Code?
Data Matrix and QR Code have lot of same features. They are both 2 dimensional (matrix) barcodes, and enable to encode ASCII text, Unicode text, binary data.
Both of them are encoding GS1 business data messages.
VB.NET Barcode SDK fully supports both Data Matrix and QR Code 2d barcodes generation in Visual Basic .NET class library, console, WinForms, WPF windows applications
Can a phone scan a Data Matrix barcode?
Yes. You can scan and read a Data Matrix barcode using your smartphone (iPhone or Android phone) with your barcode scanner app installed.