The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
[Originally posted by johnod]

Hi,

How can I force a new page to be printed after x amount of array elements.

I've tried the e.HasMorePages = true but it doesn't work, it prints 2 pages on
top of each other then prints another 2 pages on top of each other etc..


Thanks In Advance
John
import-bot (20211) [Avatar] Offline
#2
Re: Printing Array of Strings
[Originally posted by eebrown]

John,

> How can I force a new page to be printed after x amount of array elements.
>
> I've tried the e.HasMorePages = true but it doesn't work, it prints 2 pages on
> top of each other then prints another 2 pages on top of each other etc..

Yes, e.HasMorePages is the right approach. Make sure you only print a single
page per PrintPage event handler. The handler prints a single page, then
returns to the system. If e.HasMorePages is true, then the PrintPage event
handler will be called again for subsequent pages.

So to force a new page, you need to:

1) Set e.HasMorePages to true.
2) Return from your current PrintPage event handler

Does this help? Let me know if you're still stuck here.

Erik