S
Stijn Vanpoucke
Hallo, i'm having troubles by printing on more pages.
I have a counter in the PrintDocument1_PrintPage(..) and i would like to
start a new page every 3 counts.
If tried it this way:
If (i + 1) Mod 3 = 0 Then
e.HasMorePages = True
End If
Part of my code:
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Try
e.Graphics.DrawString("TKD", New Font("Arial", 20, FontStyle.Bold),
Brushes.DarkGreen, 60, 50)
e.Graphics.DrawString("Overzicht Leveranciers", New Font("Arial", 15,
FontStyle.Bold), Brushes.Black, 60, 100)
e.Graphics.DrawString("-----------------------------------------------------
------------------------------------", New Font("Arial", 15,
FontStyle.Bold), Brushes.Black, 60, 120)
Dim i As Int32
For i = 0 To DgridLeveranciers.VisibleRowCount - 2
Dim Hoogte As Int32 = i * 320
'titels
e.Graphics.DrawString("id:", New Font("Arial", 10, FontStyle.Regular),
Brushes.Black, 400, 170 + Hoogte)
e.Graphics.DrawString("Firmanaam:", New Font("Arial", 12, FontStyle.Bold),
Brushes.Black, 70, 170 + Hoogte)
....
'gegevens
e.Graphics.DrawString(DgridLeveranciers.Item(i, 0), New Font("Arial", 10,
FontStyle.Regular), Brushes.Black, 420, 170 + Hoogte)
e.Graphics.DrawString(DgridLeveranciers.Item(i, 1), New Font("Arial", 12,
FontStyle.Bold), Brushes.Black, 190, 170 + Hoogte)
........
If (i + 1) Mod 3 = 0 Then
e.HasMorePages = True
End If
Next i
'aanduiden dat dit de laatste pagina is
e.HasMorePages = False
Catch
MessageBox.Show("Er is een fout opgetreden: " & vbCrLf & Err.Number & ": " &
Err.Description, "Fout!", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
I have a counter in the PrintDocument1_PrintPage(..) and i would like to
start a new page every 3 counts.
If tried it this way:
If (i + 1) Mod 3 = 0 Then
e.HasMorePages = True
End If
Part of my code:
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Try
e.Graphics.DrawString("TKD", New Font("Arial", 20, FontStyle.Bold),
Brushes.DarkGreen, 60, 50)
e.Graphics.DrawString("Overzicht Leveranciers", New Font("Arial", 15,
FontStyle.Bold), Brushes.Black, 60, 100)
e.Graphics.DrawString("-----------------------------------------------------
------------------------------------", New Font("Arial", 15,
FontStyle.Bold), Brushes.Black, 60, 120)
Dim i As Int32
For i = 0 To DgridLeveranciers.VisibleRowCount - 2
Dim Hoogte As Int32 = i * 320
'titels
e.Graphics.DrawString("id:", New Font("Arial", 10, FontStyle.Regular),
Brushes.Black, 400, 170 + Hoogte)
e.Graphics.DrawString("Firmanaam:", New Font("Arial", 12, FontStyle.Bold),
Brushes.Black, 70, 170 + Hoogte)
....
'gegevens
e.Graphics.DrawString(DgridLeveranciers.Item(i, 0), New Font("Arial", 10,
FontStyle.Regular), Brushes.Black, 420, 170 + Hoogte)
e.Graphics.DrawString(DgridLeveranciers.Item(i, 1), New Font("Arial", 12,
FontStyle.Bold), Brushes.Black, 190, 170 + Hoogte)
........
If (i + 1) Mod 3 = 0 Then
e.HasMorePages = True
End If
Next i
'aanduiden dat dit de laatste pagina is
e.HasMorePages = False
Catch
MessageBox.Show("Er is een fout opgetreden: " & vbCrLf & Err.Number & ": " &
Err.Description, "Fout!", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub