Click here to Skip to main content
12,831,243 members (53,628 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
HI all,

I would like to print data in some from datagridview, some from label,some from textbox and some from letter header, anyone has idea?, much appreciate in advance.
Posted 25-Jan-13 18:07pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

First of all, printing the control is not such a good idea, because it would violate the isolation between data and presentation. If printing and the loop of UI could be identical in all cases, it would be find, but usually, this is not the case.

For example, imaging you print some check boxes. What, someone should click them on paper? Printed presentation is usually somewhat different from the on-screen UI. The media is very different. Print is arranges on the piece of paper, which is very different from screen.

Therefore, it's always good to isolate data layer, or data model. In this case, you can print and present data from the same data layer, but not print from scree.

Basically, use the class PrintDocument:[^].

You will find a very clear code sample at the end of the help page referenced above.

Abhishek Pant 26-Jan-13 3:44am
"Sorry, the item you requested could not be found."-link not valid
Damn, somebody is removing valid content, once in a while. And this time, with my answer. :-(
Thank you very much for the note, Abhishek.
Abhishek Pant 27-Jan-13 1:50am
That profile has been deleted so the answer for that question has been deleted.see profile from your post link-this[^]
Oh, really? I did no realize it would be done on my post. I actually did not expect people to really vote for ban.. I did not know that question posts, even answered, are also deleted.
Thank you,
OK, I hope my new answer is even better than the deleted one. Want to take a look :-)
Thank you,

Thank you,
Abhishek Pant 27-Jan-13 2:17am
nice link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170326.1 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100