Support & Downloads

Example of Creating Template Files with Visual Basic 2005

Create a Template File (Label Layout File)

  1. 1. Create a form with Visual Basic as follows.
    Create a Template File (Label Layout File)
  2. 2. Select Project -> Add Reference... to display the Add Reference dialog box and, in the COM tab, add BrssCom.

  3. 3. Double-click the Print Label button and write the following event handler code.
                        
    Private Sub btnPrint_Click(ByVal sender As System.Object, _
     ByVal e As System.EventArgs) Handles btnPrint.Click
    
     'Create a b-PAC object
     Dim ObjDoc As bpac.Document
     ObjDoc = CreateObject("bpac.Document")
    
     'Open a template file created with P-touch Editor
     'Put the LBX file and the executable file in the same folder
     Dim bRet As Boolean
     bRet = ObjDoc.Open(".\Fixed asset name.lbx")
    
     If (bRet <> False) Then  'normally open? 
    
      'Assign data to the text object of "Fixed asset name"
      ObjDoc.GetObject("Name").Text = txtName.Text
    
      'Assign data to the text object of Management section
      ObjDoc.GetObject("Section").Text = txtSection.Text
    
      'Assign data to the text object of Identification No.
      ObjDoc.GetObject("Number").Text = txtNumber.Text
    
      'Assign data to the barcode object
      ObjDoc.GetObject("QR Code1").Text = txtNumber.Text
    
      'Print
      ObjDoc.StartPrint("DocumentName", bpac.PrintOptionConstants.bpoAutoCut)
      ObjDoc.PrintOut(1, bpac.PrintOptionConstants.bpoAutoCut)
      ObjDoc.EndPrint()
    
      'Close the file
      ObjDoc.Close()
    
     Else
      Msgbox "No LBX file."
     End If
    
     'Free the b-PAC object
     ObjDoc = Nothing
    
    End Sub
                         
                    

    Note

    • You can also change an image object and configure the font settings.
    • For methods available from b-PAC, refer to the b-PAC SDK documentation.
  4. 4. Start the program and enter each item before clicking the Print Label button.

Labels are printed with values of cells of selected rows while the label layout file created with P-touch Editor is used as the template.

Note

To install the created software in another PC, b-PAC must be installed in the PC beforehand. b-PAC can be installed in the target PC in one of the following ways.

  • Download the installer for the b-PAC client component and install b-PAC.
  • Create an install project with Windows Installer (In Visual Studio 2005, select File -> Add -> New Project to display the Add New Project dialog box, then select Other Project Types -> Setup and Deployment -> Setup Project) and add a merge module (.msm file) of the b-PAC component to the install project (Select Project -> Add -> Merge Module and add ":\Program Files\Brother bPAC SDK\Redist\BrssCom.msm").

Download

FAQ

For Developers

  • Choose from Purposes

    Label printing, printer setup and management information.

  • b-PAC

    Information on application development tools for Windows

  • Mobile SDK

    Information on application development tools for mobile terminals

  • Command Reference

    Information on control command reference for label printers and mobile printers

  • Versatile software

    Information on versatile software provided by Brother

  • Choose from Models

    Introduction of Brother tools applicable to your model

  • Video Library

    Videos showing how to use SDK and other information

  • Contact Us

    Fill out the contact us form if you have questions about Brother developer tool.