开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜