How does Printing work in VB.NET2010 (Visual Studio 2010)?

Posted on 2011-04-24
Medium Priority
Last Modified: 2013-11-26
Hi, I'm using VB.NET2010, WinForms (from the complete Visual Studio2010 package).

I've asked a few questions about "Printing" in VB.NET2010 here on this forum, but I'm still a bit puzzled how the PrintDocument, PrintPreview and other printing objects actually work. Can someone please explain the process of how to set-up printing on one of your Forms (start to finish), or better yet can you provide a tutorial (preferably a video, if available) that will explain the way these objects can be used to print the contents of different data objects, like Textboxes, DataGridViews, Reports, etc.

I've always been surprised how poorly Microsoft documents their printing mechanisms. Its almost like printing wasn't a necessary part of real-world applications. How do you provide the end-user with printed deliverables?  

Thank you,
Question by:Mr_Fulano
  • 2
LVL 85
ID: 35459006
The link I provided in your other question might also be useful here:


It provides quite a few samples/examples, which show how to use various portions of the printing mechanism in VS.

In specific, this example seems to show how to directly print a report you've built:
LVL 25

Accepted Solution

SStory earned 2000 total points
ID: 35459363
Printing works by being asked to draw (this time on a  printer canvas instead of a screen canvas, one single page at a time. You as the developer must decide what should go on page N and draw that for the printer to print. You use methods in the graphics library to do so.





MSDN has a great example on it:

If you just need to print the form, check out:
LVL 25

Expert Comment

ID: 35459378
Here's something on printing datagridview

Either you must do it, or find code or controls to do it.  Like it's predecessor, (VB), VB.net allows you to do the basics, and allows you to do it far easier than before; however if you want things to be simpler you can extend functionality by purchasing third party controls.

Author Closing Comment

ID: 35735303
VERY, very good examples. Thanks you!!!

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question