Solved

printing in vb.net

Posted on 2011-09-13
4
306 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 500 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

746 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

12 Experts available now in Live!

Get 1:1 Help Now