|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problems using HasMorePages with oleDbDatareaderI 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? Hi Rave,
There are more paging samples on our website for windowsforms grids. http://www.vb-tips.com/default.aspx?ID=79afdb6a-611d-43cd-9186-def86a1baeef I think that this one comes the closest to your question. I hope this helps, Cor Show quoteHide quote "Rave_T" <tobia***@spray.se> schreef in bericht news:1142499295.891092.140130@j52g2000cwj.googlegroups.com... > 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? >
exe/dll as scheduled task
Setting Foreground Color Property at Row Level in Datagrid I can't find the error here.... Serial Date Stored procedure handling 1 parent record and multiple child recor vb.net to c# conversion help please Converting Base 2 Numbers to Base 10 Question re byte arrays and strings Hide some columns of listview Net and Bar Codes |
|||||||||||||||||||||||