473,320 Members | 1,863 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,320 software developers and data experts.

Print Question

Hi,

I am trying to build a preview of a document that I am doing...

To do it I am using a ODBCConnection and drawing a table with GDI+

The problem is that I only want 5 rows per page...
so I did this
for int j = 0; j<col;j++
{
currentRow++;
if (currentRow == 5)
{
currentRow = 0;
currentPage++;
e.HasMorePages = true;
}
...........
}

it goes into a loop and when I cancell all the pages have the same
information on it...
How can I solve this?
Nov 17 '05 #1
1 1018
Diogo,

You shouldn't check to see if the current row is equal to five. Rather,
check to see that the row is not 1 (assuming you start at 0 for your row
indexer, which you should, see example), and then if the current row doesn't
have a remainder of 1 when you divide by five (the checks are against 1
because you are incrementing the current row number before you perform your
check), you indicate that you have more pages. Something like this:

// Current row is 0. This and the current page variable
// is defined outside of your event handler.
int currentRow = 0;

// Process the current row on the current page.
...

// Increment the current row.
currentRow++;

// Perform the check here.
if ((currentRow % 0) == 1 && currentRow != 1 && currentRow != rowCount)
{
// Increment the current page count.
currentPage++;

// Indicate that there are more pages.
e.HasMorePages = true;

// Exit the event handler.
return;
}

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:BB**********************************@microsof t.com...
Hi,

I am trying to build a preview of a document that I am doing...

To do it I am using a ODBCConnection and drawing a table with GDI+

The problem is that I only want 5 rows per page...
so I did this
for int j = 0; j<col;j++
{
currentRow++;
if (currentRow == 5)
{
currentRow = 0;
currentPage++;
e.HasMorePages = true;
}
..........
}

it goes into a loop and when I cancell all the pages have the same
information on it...
How can I solve this?

Nov 17 '05 #2

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

Similar topics

12
by: Michael Foord | last post by:
Here's a little oddity with 'print' being a reserved word... >>> class thing: pass >>> something = thing() >>> something.print = 3 SyntaxError: invalid syntax >>> print something.__dict__...
9
by: François Pinard | last post by:
Hi, people. I hope someone would like to enlighten me. For any application handling Unicode internally, I'm usually careful at properly converting those Unicode strings into 8-bit strings before...
2
by: Rob McLennan - ZETLAND | last post by:
Hi, I have set up an external stylesheet, named "print.css", to format the style of all pages printed from my company's website. I've been previewing my changes to the stylesheet by doing...
1
by: Steff | last post by:
I am wandering if my code is making sense... I use a lot the print function. Is it weird in this case where I have to display an array ? I thought it would be better to have the entire array in php...
3
by: AWasilenko | last post by:
I'm still in the process of learning python via a handful of books I bought. One book I am reading just introduced Base Class Methods. I found that I needed more understanding on this concept and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.