Message.Type Property

ClosedDescription

Returns the category of the error. Read-only.

ClosedSyntax

Message.Type

ClosedRequirements

Version

BarTender 7.50 or higher

Edition

Automation, Enterprise

ClosedRemarks

Message.Type returns one of the following BtMsgType constants:

ClosedVB.NET Example

'Declare a BarTender application variable

Dim btApp As BarTender.Application

'Declare a BarTender document variable

Dim btFormat As BarTender.Format

'Declare a BarTender printer code template variable

Dim btPCT As BarTender.PrinterCodeTemplate

'Declare a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages = Nothing

'Declare a variable to hold message text

Dim btMessageText As String = ""

'Declare a loop counter

Dim i As Integer

'Create a new instance of BarTender

btApp = New BarTender.Application

'Set the BarTender application visible

btApp.Visible = True

'Open a BarTender document

btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")

'Set the printer code template variable

btPCT = btFormat.PrinterCodeTemplate

'Export the printer code template

btPCT.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\Printer Code Templates\FormatTemplate.prn", "c:\Printer Code Templates\DataTemplate.prn", btMessages)

'Ignore database messages; display the other messages

For i = 1 To btMessages.Count

If btMessages.GetMessage(i).Type = 3 Then

'Do nothing

Else

btMessageText = btMessageText & vbCrLf & btMessages.Item(i).Severity & " " & btMessages.Item(i).Message

End If

Next i

MessageBox.Show("Export failed. Errors and Warnings: " & btMessageText)

'End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

ClosedC# Example

// Declare a BarTender application variable

BarTender.Application btApp;

// Declare a BarTender document variable

BarTender.Format btFormat;

// Declare a BarTender printer code template variable

BarTender.PrinterCodeTemplate btPCT;

// Declare a BarTender messages variable to hold all messages

BarTender.Messages btMessages;

// Declare a string variable to hold message text

string btMessageText = "";

// Declare an object variable

System.Object obj = null;

// Create a new instance of BarTender

btApp = new BarTender.Application();

// Set the BarTender application visible

btApp.Visible = true;

// Open a BarTender document

btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");

// Set the printer code template variable

btPCT = btFormat.PrinterCodeTemplate;

// Export the printer code template

btPCT.Export("SAPscript-ITF", BarTender.BtPctExportType.btPctExportSeparate, "c:\\Printer Code Templates\\FormatTemplate.prn", "c:\\Printer Code Templates\\DataTemplate.prn", ref obj);

// Set the messages variable to the object

btMessages = obj as BarTender.Messages;

// Ignore database messages; display the other messages

for (int i = 1; i <= btMessages.Count; i++)

{

if (btMessages.GetMessage(i).Type == BarTender.BtMsgType.btMsgTypeDatabase)

{

// Do nothing

}

else

{

btMessageText = btMessageText + "\n\r" + btMessages.GetMessage(i).Severity + " " + btMessages.GetMessage(i).Message;

}

}

MessageBox.Show("Export failed. Errors and Warnings: " + btMessageText);

// End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);