SAP Knowledge Base Article - Public

1525043 - How to determine which button was clicked using Crystal Reports Winform Viewer click events

Symptom

How to determine which button was clicked using Crystal Reports Winform Viewer click events.

Cause

In order to get data from the report you must use the ClickPage event, but this event does not contain which button was clicked.

Resolution

You have to capture both the Click and ClickPage events to capture both the data and the button that was clicked as shown below:

string value;
private void crystalReportViewer1_ClickPage(object sender, CrystalDecisions.Windows.Forms.PageMouseEventArgs e)
{
 //fired first
        value = e.ObjectInfo.Text;
}

private void crystalReportViewer1_Click(object sender, EventArgs e)
{
        //fired second
        MouseEventArgs testMouseEventArgs = (MouseEventArgs)e;
        if (value != null)
        {
            MessageBox.Show(value + " - " + testMouseEventArgs.Button.ToString());
        }
        value = null;          
}

See Also

SAP Knowledge Base Article 1202102 - Crystal Reports Winform Viewer click events in Microsoft Visual Studio .NET.

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2