What is the easiest way to print to a printer in VB.Net?

Posted on 2005-05-12
Last Modified: 2010-04-23

I am new to VB.Net
If I wanted to Print "Hello" to a printer in a certain location what is the easiest way to do this?

Is there a ready made (function/Class) out there which will make printing easy, by just passing in various parameters?

(It appears to be a pity that they did not match slightly closer with VB6, and also include more controls like the shape control)


Question by:garyjos
    1 Comment
    LVL 1

    Accepted Solution

    Unfortunately (or fortunately, depending on how you look at it) printing in is more complex than in vb6, but you have much more control over the printer and stuff that gets printed.
    You will need to learn about the PrintDocument class (for which you will need to import a namespace called "Systems.Drawing.Printing" )... here is a good URL to get started:

    Here you'll find an example of code to print a text file:

    And here is a discussion of the changes in printing from VB6 to VB.NET:

    At first glance, it looks like a real pain... but it is something you can get used to, and you'll realize that it's more complex only because you have a lot more control...

    Have fun!!!


    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    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…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 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

    22 Experts available now in Live!

    Get 1:1 Help Now