Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

How to: Capture User Input from a PrintDialog at Run Time

While you can set options related to printing at design time, you will sometimes want to change these options at run time, most likely because of choices made by the user. You can capture user input for printing a document using the PrintDialog and the PrintDocument components.

To change print options programmatically

  1. Add a PrintDialog and a PrintDocument component to your form.

  2. Set the Document property of the PrintDialog to the PrintDocument added to the form.

    printDialog1.Document = PrintDocument1;
    
  3. Display the PrintDialog component by using the ShowDialog method.

    printDialog1.ShowDialog();
    
  4. The user's printing choices from the dialog will be copied to the PrinterSettings property of the PrintDocument component.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.