Printing Labels

This sample program shows how to insert multiple text frames simultaneously. The application is a label printing program, used to print, for instance, address labels or badges. The source code for this sample program can be found in the Samples\vb6\TextFrames\Printing Address Labels directory

The sample program contains a dialog box for entering information about the label sheet to be used, e.g. the number of labels and their dimensions.

The program then creates a text frame for each of the labels.

The text frames can them be filled out, either manually by clicking on a field and typing in text, or from a file or database. When you click on the Fill in menu item, the sample program will enter the words "Address no." followed by the field identifier into each of the frames.

To load text from a file instead, simply replace the .Text property with a call to TX Text Control's Load method.

[Visual Basic 6]
Private Sub mnuLabel_FillIn_Click()
    Dim FrameID As Integer

    FrameID = tx.ObjectNext(0, &H20)
    While FrameID
        tx.TextFrameSelect (FrameID)
        tx.Text = tx.Text = "Address no. " & FrameID
        tx.TextFrameSelect 0
        FrameID = tx.ObjectNext(FrameID, &H20)
    Wend
End Sub