I have written an application in c# and now i want to print its content in form of invoice as shown in figure i want to print costumer data only once but jobs he has asked to be performed on his car shown in datagrid view should be there in form of list with labour and total labour at the end of invoice. some people suggested to use crystal reports I have never used them so looking for a simpler solution cutting it short how can we print required values from form
The easiest and quickest solution is to use the Visual Basic PowerPack's PrintForm control (You can use it in C# projects as well).
http://msdn.microsoft.com/en-us/vbasic/bb735936.aspx
Just drag the control on to your form then from code call
printForm1.Print();
This will print whatever is on the form, so just design your report on a form then call that code, and you're done.
The last time I needed to print a few fields from a C# form, I simply created a Bitmap image using the "Bitmap" and "Graphics" object, and used "PrintDocument" to print it.
The layout of the printed report is done in code by specifying coordinates of the elements to be printed. It's cheap and dirty, but works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With