Problems using HasMorePages with oleDbDatareader

R

Rave_T

Hi all!

I want to loop through my datareader and print out 5 rowns on each page
but i cant get it to work...
Heres my code:
Dim curr_X=20
Static intItem As Integer = 0
Dim y As Integer = 0
Dim bDraw As Boolean = True
Dim g As Graphics = e.Graphics
Do Until Not bDraw
myReader.Read
e.Graphics.DrawString(myReader(1).toString, New Font("Verdana",
8, FontStyle.Regular), Brushes.Black, curr_X, rowHeight)
curr_X=200+curr_X
rowHeight=rowHeight+25
y += 15
g.DrawString(intItem.ToString, Me.Font, Brushes.Black, 10, y)
intItem += 1
bDraw = (intItem Mod 5 <> 0)
Loop
If intItem = 25 Then
intItem = 0
Else
e.HasMorePages = True
End If

The variable intItem have i just used to see if it works somehow and it
does, intItem is correctly put to 0-4 on page one and then 5-10 on page
two and so on, but the data from the datareader is the same on all
pages.....

Any ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top