Click here to Skip to main content
11,570,945 members (60,290 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: 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 17: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 at 26-Jan-13 3:44am
"Sorry, the item you requested could not be found."-link not valid
Sergey Alexandrovich Kryukov at 26-Jan-13 5:03am
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 at 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[^]
Sergey Alexandrovich Kryukov at 27-Jan-13 1:57am
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,
Sergey Alexandrovich Kryukov at 27-Jan-13 2:09am
OK, I hope my new answer is even better than the deleted one. Want to take a look :-)
Thank you,

Thank you,
Abhishek Pant at 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

Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 27 Jan 2013
Copyright © CodeProject, 1999-2015
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