[RESOLVED] e.HasMorePages don't work

yulyos

Well-known member
Joined
Jun 4, 2004
Messages
67
Location
Israel
Programming Experience
5-10
Hi,

Can someone tell me why the e.HasMorePages = True in the code below don't work
I need to print the word Aetek in a new page.
VB.NET:
Private Sub PrintDocument1_PrintPage...

e.Graphics.DrawString("Makor", DrawFont, DrawBrush, x, y, RTL_Alignment)

        e.HasMorePages = True

e.Graphics.DrawString("Aetek", DrawFont, DrawBrush, x, y, RTL_Alignment)

        e.HasMorePages = False

End Sub
Thanks in advance
 
Last edited:
That's because when it hits 'End Sub', you've set e.HasMorePages to false, so it only prints 1 page.

Use a variable to test for a 'MorePages' condition.
 
This is what I'm talking about:
VB.NET:
Private MorePages As Boolean = True

Private Sub PrintDocument1_PrintPage...
    If MorePages = True Then
        e.Graphics.DrawString("Makor", DrawFont, DrawBrush, x, y, RTL_Alignment)
        e.HasMorePages = True
    Else
        e.Graphics.DrawString("Aetek", DrawFont, DrawBrush, x, y, RTL_Alignment)
        e.HasMorePages = False
    End If
End Sub
 
Back
Top