• Data Matrix download

Print Data Matrix in Visual Basic

To print Data Matrix from Visual Basic, you need Barcodesoft BCSDatamatrix.ttf true type font and cruflbcs.dll.

If you download and install the demo of Barcodesoft Data Matrix font on your computer, you will find crUFLBCS.dll from
"C:\Program Files (x86)\Common Files\Barcodesoft\Fontutil\" folder.

If you don't find cruflbcs.dll on your computer, please download it from Data Matrix Visual Bsic..

crUFLBCS.dll is a COM object with IDataMatrix interface.
You can find detailed information about IDataMatrix interface from readme.html.

To call the methods of IDataMatrix interface from Visual Basic, you can use either Late Binding or Early Binding.

Late binding is used when type information of an object is unavailable at compile time.

Early binding requires the client to get access to the type library before compile.

Late Binding


Your codes to create Data Matrix run slower than using Early Binding.

However, your codes are version-independent as long as COM interface and method parameters remain unchanged.
Dim cruflBCSObj As Object
Set cruflBCSObj = CreateObject("cruflBCS.DataMatrix.1")
cruflBCSObj.SetCRLF (1)
Dim retval As String
retval = cruflBCSObj.Encode(strTemp)

After apply font BCSDataMatrix to returned string "retval", you will get a Data Matrix 2d barcode.
Early Binding


Early binding requires the client to get access to the type library before compile.

Your codes using early binding to print Data Matrix barcode run faster than using late binding.

Here is a sample using early binding to print Data Matrix barcode in Visual Basic. Open Visual Basic EarlyBinding Sample from the following folder
C:\Program Files\Barcodesoft\datamatrixfont\.

1. Click Project menu, choose "Add Reference..." to load the type information of cruflBCS.dll.

Data Matrix Visual Basic add reference

2. Use the following code snippet to print barcode from Visual Basic.

Data Matrix Visual Basic type information

Dim obj As cruflBCS.CDatamatrix
Set obj = New cruflBCS.CDatamatrix
Datamatrix = obj.Encode(strToEncode)
Set obj = Nothing

3. After set font to bcsDataMatrix, you will get a Data Matrix in Visual Basic.

  • Data Matrix barcode download