all groups > dotnet windows forms > march 2007 >
You're in the

dotnet windows forms

group:

PrintPreviewControl navigate pages problem.



PrintPreviewControl navigate pages problem. Chris Dunaway
3/30/2007 7:11:16 AM
dotnet windows forms: 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
Re: PrintPreviewControl navigate pages problem. Chris Dunaway
3/30/2007 9:15:52 AM
[quoted text, click to view]

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
AddThis Social Bookmark Button