Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Getting a cell value to a text box - C#, Winforms

I am using Visual Studio 2008, C#, win forms with CR 2008. The report is displayed on the Business Object viewer on the form. When customer clicks on a cell, the cell data needs to be shown on a text box on the form. is there any way to accomplish this? If not, at least highlight and copy the cell data and then customer can paste it to the text box.

Former Member
Former Member replied

You can handle the ClickPage event on the CrystalReportViewer control. The PageMouseEventArgs argument for the event contains information about the report object that was clicked in the viewer control. Note that any object in the report can be clicked on, not just database fields. You'll have to add logic to exclude the objects you don't want.

private void crystalReportViewer1_ClickPage(object sender, CrystalDecisions.Windows.Forms.PageMouseEventArgs e)
            // Collect the report object name and type.
            string msg = "Report Object: " + e.ObjectInfo.Name.ToString()
                + " (" + e.ObjectInfo.ObjectType.ToString() + ")";

            // Some report objects won't have text properties; verify that the property isn't null 
            // before attempting to access it.
            if (e.ObjectInfo.Text != null)
                msg += "... Text: " + e.ObjectInfo.Text.ToString();

            // Display the collected information in a message box.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question