Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a button on the main Form, which opens the child Form. Now, I want to print that child form, how can I do that?
Posted
Updated 1-Aug-11 21:14pm
v3

No, you don't open a child form; there is no child/parent relationships between forms. There are owned and owner forms; and I advice you use it by making all non-main forms owned by a main form.

Now, printing. Don't print the form, print the data used to populate the form's control; for that purpose, you need some data layer. In all cases, use the class System.Drawing.Printing.PrintDocument.

This help page contains a simple code sample which gives you a good idea of the usage: http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.aspx[^].

—SA
 
Share this answer
 
Comments
Asish Limbu 2-Aug-11 3:24am    
Good Answer.+5.
Sergey Alexandrovich Kryukov 2-Aug-11 3:27am    
Thank you, Asish.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900