Message.Verification Property

ClosedDescription

Returns a reference to a Verification object. Read-only.

ClosedSyntax

Message.Verification

ClosedRequirements

Version

BarTender 7.50 or higher

Edition

Automation, Enterprise

ClosedRemarks

The Message.Verification property returns a reference to the message's Verification object, which controls details of the message and whether AutoFix should be used.

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 verification variable

Dim btVerification As BarTender.Verification

'Declare a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages = Nothing

'Declare a BarTender message variable to hold individual messages

Dim btMsg As BarTender.Message

'Declare a variable to hold message text

Dim btMessageText As String = ""

'Declare a success variable

Dim ExportSuccess As Boolean

'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)

'Check to see if there is an error message

If ExportSuccess = False Then

'Loop through the messages

For i = 1 To btMessages.Count

'Get the error message

btVerification = btMessages.GetMessage(1).Verification

'Populate the error messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & " " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next i

'Display the error message

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

Else

'Loop through the messages

For Each btMsg In btMessages

'Get the warning messages

btVerification = btMessages.GetMessage(1).Verification

'Populate warning messages into a string

btMessageText = btMessageText & btVerification.Problem & vbCrLf & btVerification.Fields & " " & btVerification.AutoFix & vbCrLf & btVerification.Result

Next

'Display the warning message

MessageBox.Show("Export Succeeded. Warnings: " & btMessageText)

End If

'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 verification variable

BarTender.Verification btVerification;

// Declare a BarTender messages variable to hold all messages

BarTender.Messages btMessages;

// Declare a variable to hold message text

string btMessageText = "";

// Declare a success variable

bool ExportSuccess = true;

// 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;

// Check to see if there is an error message

if (ExportSuccess == false)

{

// Loop through the messages

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

{

// Get the error message

btVerification = btMessages.GetMessage(1).Verification;

// Populate the error messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields + " " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

// Display the error message

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

}

else

{

// Loop through the messages

foreach (BarTender.Message btMsg in btMessages)

{

// Get the error message

btVerification = btMessages.GetMessage(1).Verification;

// Populate warning messages into a string

btMessageText = btMessageText + btVerification.Problem + "\r\n" + btVerification.Fields + " " + btVerification.AutoFix + "\r\n" + btVerification.Result;

}

// Display the warning message

MessageBox.Show("Export succeeded. Warnings: " + btMessageText);

}

// End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);