Link to home
Start Free TrialLog in
Avatar of andre72
andre72

asked on

Let user choose printer on print-buttom for PrintPreview

Hi,

I need to print so sttuff from my application.
For this I use the printPreviewDialog control.
This works fine, only when the user press the print button now the output will ever be printed to the default printer.
Is there a way for to let the user select a printer when he pressed the button?
Or may be an other solution to change the printer for a printPreviewDialog?

Thanks

Andre
Avatar of x77
x77
Flag of Spain image

Note that "Print Button" on printPreviewDialog  do:

   PrintDocument.Print

You can´nt alter this behaviour.

But PrintDocument allow you override some methods. On_BeginPrint
     Also you can suscribe Event. BeginPrint

   At this Point, you can call PrintDialog to get a PrinterSettings.
   If Dialog - Ok, Then set  Document.PrinterSettings to Dialog.PrinterSettings
   If Dialog - Cancel then set  e.Cancel = true - This abort action.
Avatar of Rainverse
Rainverse

2010 (Framework 4) allows this with the PrintDialog, however, this may help with earlier versions: http://www.vbdotnetheaven.com/UploadFile/DipalChoksi/WindowsForms04202005003607AM/WindowsForms.aspx
ASKER CERTIFIED SOLUTION
Avatar of x77
x77
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nasir Razzaq
>Is there a way for to let the user select a printer when he pressed the button?

Yes. Show them a print dialog

http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.aspx
That's framework 4 only, correct?
I use PrinDialog since Net 1.1.

But this question is about show PrintDialog when user Press the Print Button on PrintPreviewDialog.


Image1.jpg
Avatar of andre72

ASKER

Yes you're right - I wrote about this button :-)
Thanks for your support