[RESOLVED] e.HasMorePages don't work
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.
Code:
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
Re: e.HasMorePages don't work
You need to have a global variable to tell the PrintPage event handler what to print on each page...
Some thing like this
Code:
Private printItem As Integer '<<< the global variable
'And when you call printdocument.Print, you do this
printItem = 0
PrintDocument1.Print()
'And then in your printpage sub, you check that global variable
Private Sub PrintDocument1_PrintPage...
If printItem = 0 Then
e.Graphics.DrawString("Makor", DrawFont, DrawBrush, x, y, RTL_Alignment)
printItem += 1 '<<< Increment the printItem variable
e.HasMorePages = True
Else
e.Graphics.DrawString("Aetek", DrawFont, DrawBrush, x, y, RTL_Alignment)
e.HasMorePages = False
End If
End Sub
Re: e.HasMorePages don't work