Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Online Members
Anil Kumar Pandey
Prasad kulkarni
Arvind kumar
Saurabh Tyagi
kumar.tyr
Vinod
Manikandan
More...
Resources
»
Code Snippets
»
DataGridView
Printing Datagridview content in windows aplication using C#.net.
Posted Date:
02-Dec-2008
Category:
DataGridView
Author:
bulli guruvu setty
Member Level:
Gold
Points
: 4
* Take one datagridview1 control.
* Take one printdocument1
* & two buttons named as retrive & print.
Develop code for retriving & bind it to the datagridview in retrive button.
Code for Print_click:
private void print_Click(object sender, EventArgs e)
{
printDocument1.Print();
}
Then develop code for printdocument1_printpage event:
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Bitmap bm = new Bitmap(this.dataGridView1.Width, this.dataGridView1.Height);
this.dataGridView1.DrawToBitmap(bm, new Rectangle(0, 0, this.dataGridView1.Width, this.dataGridView1.Height));
e.Graphics.DrawImage(bm, 0, 0);
}
Then finally execute the project.It will print the datagrinview content only.
Did you like this resource? Share it with your friends and show your love!
Tweet
Responses to "Printing Datagridview content in windows aplication using C#.net."
Author:
pradeep
16 Apr 2009
Member Level:
Bronze
Points
: 1
If a datagridview has more rows which is not displayed on the current form then whether its get printed or not. I mean if datagridview has more rows which we have to scroll down then its get printed or not.
Feedbacks
Post Comment:
Notify me by email when others post comments to this article.
Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
No HTML formatting and links to other web sites are allowed.
This is a strictly moderated site. Absolutely no spam allowed.
Name:
Sign In
to fill automatically.
Email:
(Will not be published, but
required
to validate comment)
Type the numbers and letters shown on the left.
Next Resource:
BINDING (System.Collections.Generic.List) TO GRIDVIEW
Previous Resource:
Retrive value from datagrid
Return to Resources
Post New Resource
Category:
DataGridView
Post resources and
earn money
!
More Resources
BINDING (System.Collections.Generic.List) TO GRIDVIEW
Datagrid - Editing, Updating, Cancel, Selecting Rows
Retrieving value on click of checkbox in DataList C#
Jump to nth row or move up/down row on single click
DataGridView Column Header Text with AutoEllipses(...) in C#
How to Edit,Delete,Update in Datagrid in vs2008?
Popular Tags
Tag posting guidelines
Search Tags
Printing Datagridview content
.
Active Members
Today
Anil Kumar ...
(31)
Naved Hasan ...
(30)
Ultimaterengan
(21)
Last 7 Days
naveensanagase...
(245)
baskar
(201)
Pawan Awasthi
(187)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds
Talk to Webmaster Tony John