473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problems using HasMorePages with oleDbDatareader

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?

Mar 16 '06 #1
1 1190
Hi Rave,

There are more paging samples on our website for windowsforms grids.

http://www.vb-tips.com/default.aspx?...6-def86a1baeef

I think that this one comes the closest to your question.

I hope this helps,

Cor

"Rave_T" <to******@spray.se> schreef in bericht
news:11**********************@j52g2000cwj.googlegr oups.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?

Mar 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mr. B | last post by:
VB.net (standard) I'm experiencing some difficulties in printing multiple pages using Print Preview. The following is my main parts of my printing subs (excess info deleted for your viewing...
3
by: DGeorge | last post by:
I have a problem where after setting the HasMorePages = True will not print the 2nd Pages. Does anybody have an idea or knows this problem. Thanks for any advice
3
by: islay | last post by:
Hello, I'm trying to print more than one page using the PrintDocument object. I set "e.HasMorePages = True" after completeing the first page in the "PrintDocument1_PrintPage" subroutine, and...
1
by: Brenton Garman | last post by:
hello all..... I can currently print out only one page with the following code...(note it lacks the e.hasmorepages=false) Private Sub PrintToolStripButton_Click(ByVal sender As System.Object,...
2
by: Leo | last post by:
I set HasMorePages to true, but it doesn't let me jump to next page. (Of course, if I remove the HasMorePages = false in my if statement, it will create hundreds of pages). Any suggestion? Thanks...
6
by: moti | last post by:
Whenever I use PrintDocument.Print() to print a page it goes to PrintDocument_PrintPage and stays there forever unless I set e.HasMorePages to False. When I set it to False it prints the page but...
0
by: creedence | last post by:
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...
0
by: thirunavukarasukm | last post by:
Hai.... To print Html page using PrintDialog and Print Document i am created one windows appication.. the windows application have many pages in my booking page i have two buttons one...
2
by: GGSoft | last post by:
Please Can't understand how to use HasMorepages. I spent a lot of time on this task. but I have no result. For examle I want to print every 45 record on each new page. Please Rewrite the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.