Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

printing in vb.net

Posted on 2011-09-13
4
Medium Priority
?
315 Views
Last Modified: 2013-05-03
Hello All!

What's the equivalent to

Printer.print "Hello World" & vbcrlf
Printer.print "I am here!"

from VB6 in VB.NET?

Thanks!
0
Comment
Question by:pvg1975
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
kbirecki earned 2000 total points
ID: 36533526
0
 

Author Comment

by:pvg1975
ID: 36533603
Great solution! Thanks!
Private Sub Button11_Click_1(sender As System.Object, e As System.EventArgs) Handles Button11.Click
        Dim prn As New Printing.PrintDocument
        prn.PrinterSettings.PrinterName.ToString()
        AddHandler prn.PrintPage, AddressOf Me.PrintPageHandler
        prn.Print()
        RemoveHandler prn.PrintPage, AddressOf Me.PrintPageHandler

    End Sub
    Private Sub PrintPageHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
        args.Graphics.DrawString("HelloWorld With A Printer", New Font("Arial", 20, FontStyle.Bold), Brushes.Black, 150, 125)
    End Sub

Open in new window

0
 
LVL 11

Expert Comment

by:kbirecki
ID: 36533604
Glad it worked for you!  Thanks for the points.
0
 

Expert Comment

by:Larry Biederman
ID: 39135930
Hi pvg1975,

Well, sir, that works perfectly!
Quick question before I award you all the points:

Is this the best, shortest syntax just to dump variables etc to paper?
Can this also be used to dump to a screen?

Thanks, Lbiederman
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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 (http://www.ecb.europa.eu/stats/exch…
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.
Loops Section Overview
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

916 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