PrintPreviewControl navigate pages problem.

C

Chris Dunaway

I am using the PrintPreviewControl on a custom form to display a
report. The report is multiple pages. I have a NumericUpDown control
on the form to navigate the pages of the report. In the ValueChanged
event of the UpDown control I change the StartPage property like this:

private void udPageNo_ValueChanged(object sender, EventArgs e)
{
ppReport.StartPage = Convert.ToInt32(udPageNo.Value);
}

This works fine when *increasing* the page number, but it does not
work when paging down!

If I place a call to InvalidatePreview just after I set the StartPage
property, then the page will change (going back down) but it causes
the preview to be regenerated. The preview is slow in generating so I
don't want to take this route.

Has anyone else experienced this issue? Is there a work around?

Thanks,

Chris
 
C

Chris Dunaway

I am using the PrintPreviewControl on a custom form to display a
report. The report is multiple pages. I have a NumericUpDown control
on the form to navigate the pages of the report. In the ValueChanged
event of the UpDown control I change the StartPage property like this:

private void udPageNo_ValueChanged(object sender, EventArgs e)
{
ppReport.StartPage = Convert.ToInt32(udPageNo.Value);
}

This works fine when *increasing* the page number, but it does not
work when paging down!

If I place a call to InvalidatePreview just after I set the StartPage
property, then the page will change (going back down) but it causes
the preview to be regenerated. The preview is slow in generating so I
don't want to take this route.

Has anyone else experienced this issue? Is there a work around?

Thanks,

Chris

For anyone else dealing with this same problem, the cause was a
boneheaded mistake by the developer (me). The StartPage property is 0
based. However, if you assign a page number beyond the number of
pages, it does not seem to throw an ArgumentOutOfRange exception. I
might have caught the problem sooner if I had gotten an exception.

Oh well,

Chris
 

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