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, please help!!!!
Private Sub PrintDocument1_ PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing. Printing.PrintP ageEventArgs) 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.Table s(0).Rows(i).It em("Datum").ToS tring
e.Graphics.Draw String(row0,
FontDialog1.Fon t,Brushes.Black , 100, c)
Dim row1 As String
=Form1.Ds.Table s(0).Rows(i).It em("Stranka").T oString
e.Graphics.Draw String(row1,
FontDialog1.Fon t,Brushes.Black , 200, c)
Dim row2 As String
=Form1.Ds.Table s(0).Rows(i).It em("Adresa stranke").ToStr ing
e.Graphics.Draw String(row2,
FontDialog1.Fon t,Brushes.Black , 350, c)
Dim row3 As String =
Form1.Ds.Tables (0).Rows(i).Ite m("Brojnaloga") .ToString
e.Graphics.Draw String(row3,
FontDialog1.Fon t,Brushes.Black , 650, c)
Dim row4 As String
=Form1.Ds.Table s(0).Rows(i).It em("Pocetno stanje").ToStri ng
e.Graphics.Draw String(row4,
FontDialog1.Fon t,Brushes.Black , 750, c)
Dim row5 As String
=Form1.Ds.Table s(0).Rows(i).It em("Zavrsno stanje").ToStri ng
e.Graphics.Draw String(row5,
FontDialog1.Fon t,Brushes.Black , 850, c)
Dim row6 As String
=Form1.Ds.Table s(0).Rows(i).It em("Km").ToStri ng
e.Graphics.Draw String(row6,
FontDialog1.Fon t,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.Draw Line(blackPencr ta2, point31, point32)
e.Graphics.Draw Line(blackPencr ta2, 90, 50, 90, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 190, 50, 190, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 340, 50, 340, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 640, 50, 640, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 740, 50, 740, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 840, 50, 840, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 940, 50, 940, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 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
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, please help!!!!
Private Sub PrintDocument1_ PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing. Printing.PrintP ageEventArgs) 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.Table s(0).Rows(i).It em("Datum").ToS tring
e.Graphics.Draw String(row0,
FontDialog1.Fon t,Brushes.Black , 100, c)
Dim row1 As String
=Form1.Ds.Table s(0).Rows(i).It em("Stranka").T oString
e.Graphics.Draw String(row1,
FontDialog1.Fon t,Brushes.Black , 200, c)
Dim row2 As String
=Form1.Ds.Table s(0).Rows(i).It em("Adresa stranke").ToStr ing
e.Graphics.Draw String(row2,
FontDialog1.Fon t,Brushes.Black , 350, c)
Dim row3 As String =
Form1.Ds.Tables (0).Rows(i).Ite m("Brojnaloga") .ToString
e.Graphics.Draw String(row3,
FontDialog1.Fon t,Brushes.Black , 650, c)
Dim row4 As String
=Form1.Ds.Table s(0).Rows(i).It em("Pocetno stanje").ToStri ng
e.Graphics.Draw String(row4,
FontDialog1.Fon t,Brushes.Black , 750, c)
Dim row5 As String
=Form1.Ds.Table s(0).Rows(i).It em("Zavrsno stanje").ToStri ng
e.Graphics.Draw String(row5,
FontDialog1.Fon t,Brushes.Black , 850, c)
Dim row6 As String
=Form1.Ds.Table s(0).Rows(i).It em("Km").ToStri ng
e.Graphics.Draw String(row6,
FontDialog1.Fon t,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.Draw Line(blackPencr ta2, point31, point32)
e.Graphics.Draw Line(blackPencr ta2, 90, 50, 90, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 190, 50, 190, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 340, 50, 340, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 640, 50, 640, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 740, 50, 740, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 840, 50, 840, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 940, 50, 940, c + 20)
e.Graphics.Draw Line(blackPencr ta2, 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