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

Posted on 2011-04-24
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
    LVL 84
    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

    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

    Here's something on printing datagridview

    Either you must do it, or find code or controls to do it.  Like it's predecessor, (VB), 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

    VERY, very good examples. Thanks you!!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now