Hello
I have a problem with printing data from dataset.I dont know how to
make that print is go on to the next page.
I know that is something with hasmorepages = true but i dont Know how
to use it.
Here is my code, so every help is greatful.
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Dim i As Integer = 0
Dim c As Integer = 100
Dim a As Integer = 0
While i < Form1.Ds.Tables(0).Rows.Count - 1
Dim row0 As String
=Form1.Ds.Tables(0).Rows(i).Item("Datum").ToString
e.Graphics.DrawString(row0,
FontDialog1.Font,Brushes.Black, 100, c)
Dim row1 As String
=Form1.Ds.Tables(0).Rows(i).Item("Stranka").ToStri ng
e.Graphics.DrawString(row1,
FontDialog1.Font,Brushes.Black, 200, c)
Dim row2 As String
=Form1.Ds.Tables(0).Rows(i).Item("Adresa stranke").ToString
e.Graphics.DrawString(row2,
FontDialog1.Font,Brushes.Black, 350, c)
Dim row3 As String =
Form1.Ds.Tables(0).Rows(i).Item("Brojnaloga").ToSt ring
e.Graphics.DrawString(row3,
FontDialog1.Font,Brushes.Black, 650, c)
Dim row4 As String
=Form1.Ds.Tables(0).Rows(i).Item("Pocetno stanje").ToString
e.Graphics.DrawString(row4,
FontDialog1.Font,Brushes.Black, 750, c)
Dim row5 As String
=Form1.Ds.Tables(0).Rows(i).Item("Zavrsno stanje").ToString
e.Graphics.DrawString(row5,
FontDialog1.Font,Brushes.Black, 850, c)
Dim row6 As String
=Form1.Ds.Tables(0).Rows(i).Item("Km").ToString
e.Graphics.DrawString(row6,
FontDialog1.Font,Brushes.Black, 950, c)
Dim blackPencrta2 As New Pen(Color.Black, 1)
Dim point31 As New Point(90, c + 20)
Dim point32 As New Point(1050, c + 20)
' Draw line to screen.
e.Graphics.DrawLine(blackPencrta2, point31, point32)
e.Graphics.DrawLine(blackPencrta2, 90, 50, 90, c + 20)
e.Graphics.DrawLine(blackPencrta2, 190, 50, 190, c + 20)
e.Graphics.DrawLine(blackPencrta2, 340, 50, 340, c + 20)
e.Graphics.DrawLine(blackPencrta2, 640, 50, 640, c + 20)
e.Graphics.DrawLine(blackPencrta2, 740, 50, 740, c + 20)
e.Graphics.DrawLine(blackPencrta2, 840, 50, 840, c + 20)
e.Graphics.DrawLine(blackPencrta2, 940, 50, 940, c + 20)
e.Graphics.DrawLine(blackPencrta2, 1050, 50, 1050, c + 20)
i = i + 1
c = c + 20
a = a + 1
If a = 33 Then
e.HasMorePages = True
c = 100
a = 0
Else
e.HasMorePages = False
End If
End While
end sub