Create Data Matrix 2D Barcodes with VB.NET in .NET WinForms
Step 1. Add a Reference to BarCodeWizFonts.DataMatrix.dll
- Click on Project > Add Project Reference...

- Click Browse...

- Locate BarCodeWizFonts.DataMatrix.dll and click Add. The default location is:
C:\Program Files\BarCodeWiz\BarCodeWiz Data Matrix Fonts\DotNet\net40 (use with .NET 4.0 or newer)
C:\Program Files\BarCodeWiz\BarCodeWiz Data Matrix Fonts\DotNet\net20 (use with .NET 2.0 or newer)

Step 2. Add the following controls to your form:
- 1. TextBox (TextBox1) - text input, will be converted to barcode
- 2. Button (Button1) - to trigger the conversion. Set its Text property to "Encode"
- 3. Label (Label1) - to display the encoded barcode

Step 3. Edit the label properties
- Set the Font to BCW_DM, 18pt,
- Set UseMnemonic to False

Step 4. Add code to convert the text to barcode
- Double-click on Button1 and replace everything in the Click event with the following code.:
Imports BarCodeWizFonts.DataMatrix
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim encoder As New DataMatrixFonts
Label1.Text = encoder.Encode(TextBox1.Text)
End Sub
End Class
Final result.
