Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print Invoice C# Winforms

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 formalt text

like image 241
Afnan Bashir Avatar asked Dec 06 '10 20:12

Afnan Bashir


2 Answers

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.

like image 117
theChrisKent Avatar answered Sep 26 '22 02:09

theChrisKent


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.

like image 36
Moshe Avatar answered Sep 26 '22 02:09

Moshe