The Format.CancelPrinting function displays a prompt that allows the user to cancel the print job manually. Alternatively, this function can display a prompt that simply informs the user that the print job is cancelled. If ContinueLabelButton is null (""), the user cannot prevent the cancellation of the print job and the message has only an OK button. If ContinueLabelButton is omitted from the Format.CancelPrinting function, the resulting dialog contains a Cancel button, as well as a Continue button. If ContinueLabelButton is present and not null, it specifies the label of the second button.
The following example demonstrates the Format.CancelPrinting function in use. The code checks the number of serialized labels. If the number of serialized labels is greater than 1000, BarTender will display a prompt dialog that informs the user that there are too many labels.This dialog has a single OK button. If the number is between 500 and 1000 serialized labels, BarTender displays a prompt that gives the user the option of cancelling the print job or letting it continue. This prompt will have a Cancel button and a Print Anyway button.
If Format.NumberSerializedLabels > 1000 Then
Call Format.CancelPrinting("Too Many Labels. Job is being cancelled.", "")
ElseIf Format.NumberSerializedLabels > 500 AND Format.NumberSerializedLabels < 1000 Then
Call Format.CancelPrinting("500-1000 Labels. Do you want to cancel?", "Print Anyway")
End If