Skip to Content
0
Jul 23, 2013 at 10:05 AM

Problem using the "go to page" functionality in the Crystal Report Viewer

87 Views

Hi all

I have a problem when I try to use the "go to page" functionality in the Crystal Report Viewer.

My application has been developed with VS2010 using c++/cli and I have a very simple CDialog that contains the report viewer.

CTestCRViewer2010Dlg::CTestCRViewer2010Dlg(CWnd* pParent /*=NULL*/)

: CDialog(CTestCRViewer2010Dlg::IDD, pParent)

{

}

void CTestCRViewer2010Dlg::DoDataExchange(CDataExchange* pDX)

{

CDialog::DoDataExchange(pDX);

DDX_ManagedControl(pDX, IDC_REPORTVIEWER, m_reportViewer);

}

BEGIN_MESSAGE_MAP(CTestCRViewer2010Dlg, CDialog)

//}}AFX_MSG_MAP

END_MESSAGE_MAP()

BOOL CTestCRViewer2010Dlg::OnInitDialog()

{

CDialog::OnInitDialog();

ReportDocument ^reportDocument ;

reportDocument = gcnew ReportDocument();

reportDocument->Load("C:\\Lantek\\Expert\\Reports\\PUNLISTA.rpt");

m_reportViewer->ReportSource = reportDocument;

return TRUE;

}

Everything seems to work properly except from the "go to page" functionality: when I change the page number in the text box and I press the enter key to go to that page, nothing happens.

I have tried to solve the problem handling the key press event from the CDialog, but I do not know how to force the viewer to handle the event or how to get the page number from the text box and use the ShowNthPage function of the viewer.

Is it possible to use one of these solutions or is there a better way to solve the problem?

I am using Crystal Reports for Visual Studio 2010 with SP6.

Thank you very much in advance.

Best regards,

Aitor