Click here to Skip to main content
15,947,389 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to print a form containing dataGrid. But i dont know where to start from

What I have tried:

I dont realy know where to start from yet.
Posted
Updated 17-Apr-17 0:49am
Comments
Michael_Davies 17-Apr-17 6:43am    
Use the search box on this site for articles on printing, there are many.

Have a tried to ask Google this question ?

Here is one (of many more) possible suggestions :
http://stackoverflow.com/questions/13821715/print-windows-form-in-c-sharp
 
Share this answer
 
Basically, don't.
You can do it - install the Visual Basic Power Pack and you get a PrintForm component even in C# - but it doesn't really do a good job: printing a form gives you a picture of what the user sees, including buttons and such like which shouldn't be there, and doesn't show you anything which is currently scrolled out of view. It's quick and dirty, and most of teh time it's a false economy as the users soon discover it's limitations and want the whole data grid content printed.

Instead, look at the PrintDocument class: PrintDocument Class (System.Drawing.Printing)[^] - it's mopre work initially, but it produces a better result and is a huge time saver in the long run, and it's isn't that complicated once you have got your head around it. The link includes a basic example.
 
Share this answer
 

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