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.

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);
[Visual Basic]
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.