printing a multiline docuement in Visual basic 2005

Messages
8,474
Location
Australia
How do you print a multiline document,So it will print the First name and the last name on the same line and start a new line and print the address?

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Print As New myPrinter
Print.prt(px.Text &
"." & fn.Text & " " & ln.Text & " " & add.Text)


End Sub
End
Class
Public
Class myPrinter
Friend TextToBePrinted As String
Public Sub prt(ByVal text As String)
TextToBePrinted = text
Dim prn As New Printing.PrintDocument
Using (prn)
prn.PrinterSettings.PrinterName _
=
"Canon Bubble-Jet BJC-2100SP"
AddHandler prn.PrintPage, _
AddressOf Me.PrintPageHandler
prn.Print()
RemoveHandler prn.PrintPage, _
AddressOf Me.PrintPageHandler
End Using
End Sub
Private Sub PrintPageHandler(ByVal sender As Object, _
ByVal args As Printing.PrintPageEventArgs)
Dim myFont As New Font("Microsoft San Serif", 20)
args.Graphics.DrawString(TextToBePrinted, _
New Font(myFont, FontStyle.Regular), _
Brushes.Black, 50, 50)
End Sub
End
Class

This is for a label maker.
 
Back
Top Bottom