How can a easily print multible text pages

Thunderinme

New member
Joined
Feb 12, 2005
Messages
1
Location
Bonnievale,South Africa
Programming Experience
1-3
I am using this code to print but it only prints one page.

PrivateSub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click

AddHandler PrintDocument2.PrintPage, AddressOfMe.PrintDocument2_PrintPage

Me.RichTextBox1.Text = ""

Dim i AsInteger

Dim check AsString

Dim stream_reader AsNew IO.StreamReader("Data\print.txt")

Dim line AsString

' Read the file one line at a time.

line = stream_reader.ReadLine()

DoWhileNot (line IsNothing)

'Trim and make sure the line isn't blank.

line = line.Trim()

If line.Length > 0 Then _

RichTextBox1.AppendText(vbNewLine & line)

' Get the next line.

line = stream_reader.ReadLine()

Loop

stream_reader.Close()

PrintDocument2.Print()

EndSub

PrivateSub PrintDocument2_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument2.PrintPage

Dim s AsString

Dim myfont As Font

myfont = New Font("Times New Roman", 12, FontStyle.Regular)

s = RichTextBox1.Text

e.Graphics.PageUnit = GraphicsUnit.Document

e.Graphics.DrawString(s, myfont, Brushes.Black, 150.0, 150.0)

' Indicate that this is the last page to print.

e.HasMorePages = False

EndSub

How can i print more than one page using a richtextbox as above, could anybody please help, thanks.
 
Top Bottom