2. Insert the barcode into the document

Add a Button to the form and add Insert Barcode as the Content.

Double-click the just created button to insert the Clicked event handler.

Add the following code to the Click procedure of the button:

private void Button_Click_1(object sender, RoutedEventArgs e)
	TXTextControl.DataVisualization.BarcodeFrame bcFrame =
		new TXTextControl.DataVisualization.BarcodeFrame(txBarcodeControl1);
	textControl1.Barcodes.Add(bcFrame, -1);
[Visual Basic]
Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
	Dim bcFrame As New TXTextControl.DataVisualization.BarcodeFrame(txBarcodeControl1)
	textControl1.Barcodes.Add(bcFrame, -1)
End Sub

Start the application and click the button Insert Barcode. The TXBarcodeControl object has been added to the document in TextControl and is saved along with the document when saved as a document.