开发者

Receiving an 'InvalidPrinterException' - "No Printers are installed." Error

开发者 https://www.devze.com 2022-12-11 12:25 出处:网络
But I have several printers installed.I think the code is pretty standard... Dim printDocument As New System.Drawing.Printing.PrintDocument

But I have several printers installed. I think the code is pretty standard...

    Dim printDocument As New System.Drawing.Printing.PrintDocument
    Dim pageSetupDialog As New System.Windows.Forms.PageSetupDialog
    pageSetupDialog.Document = printDocument
    pageSetupDialog.ShowDialog()

Did I miss something? I can even enumerate through my printers in cod开发者_高级运维e (I've got five of them). One is set as the system default. What's going on?


Did you try assigning PageSettings and PrinterSettings on your dialog before calling ShowDialog() ?

pageSetupDialog .PageSettings = _
    New System.Drawing.Printing.PageSettings

pageSetupDialog .PrinterSettings = _
    New System.Drawing.Printing.PrinterSettings

Source.

EDIT: This page about the exception says:

Make sure a default printer has been installed.

Do you have one installed?

0

精彩评论

暂无评论...
验证码 换一张
取 消