Showprintdialog Error Visiblewindows 追蹤

0
Avatar
Legacy Poster

I have a VB.Net 4.0 application that works fine until they select to show the print dialog. When they select to show dialog it gives an VisibleWindows must be set to All or InteractiveDialog.

 

Sample code:

 Using btEngine As Engine = New Engine(True)                   
    'Get the filename from the database to open
    Dim labelFormat As LabelFormatDocument = btEngine.Documents.Open(drPartLabel("ProductLabelTypeFilename"))

    'Get the list of fields and their values for the label
    Dim dsPartLabelFields As DataSet = _PartLabels.GetPartLabelFields(ProductLabelNbr, PartNbr)                

    'Start Printing labels
    If ProductLabelSerialized = 0 Then
        labelFormat.PrintSetup.IdenticalCopiesOfLabel = Math.Ceiling(LabelPrintQty * ProductLabelQty)
        labelFormat.PrintSetup.NumberOfSerializedLabels = 1
    Else
        labelFormat.PrintSetup.IdenticalCopiesOfLabel = ProductLabelQtySame
        labelFormat.PrintSetup.NumberOfSerializedLabels = CInt(LabelPrintQty * ProductLabelQty)
    End If

    If CustomBoxLabels > 0 Then
        labelFormat.PrintSetup.IdenticalCopiesOfLabel = CustomBoxLabels
    End If

    labelFormat.PrintPreview.ShowPrintDialogOnPrint = chkShowBT.Checked
    labelFormat.Print("ProductLabels")
    _PartLabels.SaveProductLabelPrintJob(ProdWorkOrder, ProductLabelNbr, "LAURIE", SNStart,     labelFormat.PrintSetup.NumberOfSerializedLabels, labelFormat.PrintSetup.IdenticalCopiesOfLabel)
End Using

 

I have tried to put the following in just before ShowPrintDIalogOnPrint but it doesn't help:
 
btEngine.Window.VisibleWindows = VisibleWindows.InteractiveDialogs

 

2 意見

0
Avatar
Domingo Rodriguez
版主
評論操作 永久連結

Do you mean that you still get the same error message, even if you declare btEngine.Window.VisibleWindows = VisibleWindows.InteractiveDialogs, or that you don't get the error message anymore but the print dialog is still not being shown?

 

Is the BarTender process being used under a service context? If yes, then I expect the interactive dialogs to not appear, as you're running it as a service. Only if you would run the BarTender process under the same Windows account you're currently logged under (and run the process as an application) I would expect this to work. 

0
Avatar
Legacy Poster
評論操作 永久連結

Sorry. When I put the VisibleWindows in the error does not appear but the Print Dialog never comes up.

登入寫評論。