Believe me, it is easy. As with any class, before we can use any of the Classes, Events and Objects available to us in the .Net Framework we need to import the Namespaces we need. For this we need 3 namespaces. VB.Net users only required 2 because VB.Net assumes the System Namespace, whereas C# isn’t so kind:
System System.Drawing System.Drawing.Printing These 3 Namespaces contain everything we need for this class, so you will need to add the following lines to the top of your class file:
You can assign a printer and other settings by using the basic PrintDocument and PrintDialog controls properties. Look at the next example:
if (printDialog.ShowDialog() == DialogResult.OK) { printDocument.PrinterSettings.PrinterName = printDialog.PrinterSettings.PrinterName; printDocument.PrinterSettings.Copies = printDialog.PrinterSettings.Copies; }