Tutorial: Starting with Microsoft Visual Studio 2012 (2010), TX Text Control and TX Barcode

This tutorial shows the required steps to insert a TX Barcode .NET control into a TX Text Control document.

The source code is contained in the following directories:

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

1. Creating the Project and Controls

Start Visual Studio .NET and create a new project. Select either Visual Basic or C# as a project type, and Windows Forms Application as a template.

Image

Find the TX Text Control 19.0 toolbox tab that has been created automatically. All usable TX Text Control controls or components are listed in this tab.

Image

Click on the TextControl icon and draw it on the form.

Image

Find the TX Barcode 2.0 toolbox tab that has been created automatically. The available barcode control is listed in this tab.

Image

Click on the TXBarcodeControl icon and draw it somewhere onto the form.

Image

2. Insert the Barcode into the Document

Add a MenuStrip to the form and add the menu Insert with a submenu item Barcode to this MenuStrip.

Image

Double-click the just created submenu item Barcode to insert the Clicked event handler.

Add the following code to the Click procedure of the menu item:

private void barcodeToolStripMenuItem_Click(object sender, EventArgs e)
{
    TXTextControl.DataVisualization.BarcodeFrame bcFrame =
        new TXTextControl.DataVisualization.BarcodeFrame(txBarcodeControl1);
    textControl1.Barcodes.Add(bcFrame, -1);
}
Private Sub barcodeToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles barcodeToolStripMenuItem_Click.Click
    Dim bcFrame as TXTextControl.DataVisualization.BarcodeFrame = _
        New TXTextControl.DataVisualization.BarcodeFrame(txBarcodeControl1)
    textControl1.Barcodes.Add(bcFrame, -1)
End Sub

Start the application, open the main menu and choose Barcode from the Insert menu. The TXBarcodeControl object has been added to the document in TextControl and is saved along with the document when saved as a document.

Image