Replacing the Barcode Text Dynamically

This sample shows how to insert a barcode control into a TX Text Control with a specific name. Based on the barcode's name, data is merged dynamically into the control from an external XML data source.

The source code is contained in the following directories:

  • Samples\WinForms\CSharp\TextControl\ReplaceData
  • Samples\WinForms\VB.NET\TextControl\ReplaceData

A real-world scenarios, barcodes are added to document templates that are used for invoices, delivery notes or bank statements. On each of these documents, barcodes are used nowadays.

Open the sample application in Visual Studio and run it. Choose Barcode from the main menu Insert to open the Insert Barcode dialog. Choose a Barcode Type and one of the four available BarcodeFrame Name options. Insert the barcode using Insert.

Image

Repeat the above step as many times as you want with different names.

Image

Now, choose Replace from the Data main menu.

The sample iterates through all data rows of the loaded XML data source. If a BarcodeFrame matches the Name column in the data row, the value is applied to the barcode.

Image