Search code examples
c#wpfcrystal-reports

Set page number of report programmatically


How can I set the page number when viewing a Crystal Report? I tried:

crystalReportsViewer.ViewerCore.CurrentPageNumber = result;

But that doesn't work.


Solution

  • You'll want to use the ShowNthPage() function.

    crystalReportsViewer.ViewerCore.ShowNthPage(result);
    

    This assumes the number of page you wish to display is either constant or calculable. If the desired page gets pushed up or down due to added/removed records, you'll need to take that into account somehow.