Skip to main content



Print Datatable Or Datagridview



  • Avatar
    Fernando Ramos Miracle

    Hello Miguel,


    There are different methods of printing labels sourcing information form a datatable or database, although you won't need the use of the "Substring" class. Basically you'll need to design your label document to read the information from the required database type.


    BarTender documents can be designed to read data from one or more database connections such as text files, OLE DB, or ODBC. Database connection settings are configured using a LabelFormat's DatabaseConnections collection. Each DatabaseConnection contained in the collection contains settings specific to the database type. 
    Please visit BarTender's Help documentation and search for the "Automating Database Printing" document, as it fully describes how to do what you are looking for.
    Below you'll find a simple example when using a text file as database:


    Imports Seagull.BarTender.Print.Database
    ' Application Code 
    ' ... 
    Dim btEngine As New Engine()
    ' Start a BarTender print engine 
    ' Open a label format 
    Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("c:\MyLabel.btw")
    ' Set the TextFile database connection file name 
    CType(btFormat.DatabaseConnections("TextFileDB"), TextFile).FileName = "c:\NutritionInformationEurope.txt"
    ' Print the label format document 
    ' Stop the engine 


  • Avatar
    Legacy Poster



    I am just starting out with BarTender, right now I am using Crystal Reports and VS 2010 C# to design a complex Prescription label with multiple barcodes etc. and printing to a Zebra 110Xi4 printer

    and the Data Source I send to the report (Label) is a Data Table created and populated at Run Time


    but now I want to start with BarTender, but nowhere can I find an answer on If its possible to send the Data Table at run time to the BarTender document, the post above was the closest I got to this answer, but still all you said is that all types of Database connections can be made, but I don't want a database or a file or even XML to be the DB connection and source, I want to send a DataTable


    is this possible with BarTender, and can you give me an example of how?


    Thank you


  • Avatar
    Mr Das

    anyone got solution ? for this ? or how can i print data from database


Please sign in to leave a comment.