Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient
Imports System.Threading.Thread
Public Class Form1
Dim btApp As BarTender.Application
Dim btFormat As BarTender.Format
Dim btPrintRtn As BarTender.BtPrintResult
Dim btMsgs As BarTender.Messages
Dim btDB As BarTender.Database
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'Declaring BarTender variables 'Instantiating the BarTender object
btApp = New BarTender.ApplicationClass()
'Setting the BarTender Application visible
btApp.Visible = True
'Setting the BarTender format to open
btFormat = btApp.Formats.Open("D:\Format1.btw", False, "")
' btFormat.Databases.GetDatabase(1) 'Dim SQL As String = "SELECT Asset FROM TBL_SLAS_SEAT" 'btFormat.DatabaseConnections.SetDatabaseConnection(btDB)
btPrintRtn = btFormat.Print("Job1", True, -1, btMsgs)
'Check messages if error 'Dim SQL As String = "SELECT `Calories` FROM NutritionInformation`"
'Dim btEngine As New Engine()
'Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("C:\NutritionLabel.btw")
'CType(btFormat.DatabaseConnections(0), OleDb).SQLStatement()= SQL
Dim msg As BarTender.Message
If (btPrintRtn <> BarTender.BtPrintResult.btSuccess) Then
For Each msg In btMsgs
MessageBox.Show(msg.Message)
Next msg
End If
'Ending the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
End Sub
End Class
Tag : .NET, Win (Windows App), VB.NET, VS 2010 (.NET 4.x), VS 2012 (.NET 4.x)