--- title: "How to: Capture User Input from a PrintDialog at Run Time" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" - "cpp" helpviewer_keywords: - "print options [Windows Forms], changing at run time" - "printing [Windows Forms], options" - "print options" - "run time [Windows Forms], changing print options" ms.assetid: 438501d8-9a70-4fb3-aae6-e46579aba0c6 --- # 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 and the components. ### To change print options programmatically 1. Add a and a component to your form. 2. Set the property of the to the added to the form. ```vb PrintDialog1.Document = PrintDocument1 ``` ```csharp printDialog1.Document = PrintDocument1; ``` ```cpp printDialog1->Document = PrintDocument1; ``` 3. Display the component by using the method. ```vb PrintDialog1.ShowDialog() ``` ```csharp printDialog1.ShowDialog(); ``` ```cpp printDialog1->ShowDialog(); ``` 4. The user's printing choices from the dialog will be copied to the property of the component. ## See also - [How to: Print a Multi-Page Text File in Windows Forms](how-to-print-a-multi-page-text-file-in-windows-forms.md) - [Windows Forms Print Support](windows-forms-print-support.md)