Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi guys

i have a problem to print whole form content including datagridview content. In my form some other details are present on top and two datagridview binded data is shown in below.......i am wanting to print both datagridview and content on form and see print preview in pdf then print all content

e.g; Name(Label1) David(Textbox1)
add(Label2) India(Textbox2)



....please help me.........
Thank You!
Updated 13-Oct-11 22:26pm
devildx2050 14-Oct-11 4:38am    
i think its better you can crystal report for your problem.

There is a code project article on this

Printing a DataGridView on DotNet Framework[^]
Share this answer
rajesh102011 17-Oct-11 2:52am    
thank you sir,

it is only print content of datagridview, i just want to do to print whole form content like textbox data, label Name, combobox selected item(in Windows Form) it should first previewed then print. etc.......
Try this one:

Place all the content what u want to print in a div and refer following link

Print a purticular area of webpage[^]
Share this answer
rajesh102011 17-Oct-11 2:55am    
thank you

but i want to print content of form in Windows Form(Windows Application in c#)
This works fine for me
<script type="text/javascript">
    function printPartOfPage(elementId) {
        var printContent = document.getElementById(elementId);
//this is the id of the div in which the complete content is placed
        var windowUrl = 'Test';
        var uniqueName = new Date();
        var windowName = 'Print' + uniqueName.getTime();
        var printWindow =, windowName, 'left=50,top=50,width=600,height=400');
Share this answer
rajesh102011 17-Oct-11 2:58am    
thank you,

sir/ma'm I want to printing content of windows form(Windows Applicatio in c#)
Share this answer
Anuja Pawar Indore 17-Oct-11 3:24am    
Refer this too

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