cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

When customer clicks on a cell, the cell data needs to be shown on a text box on the form.

- where would the data come from?

- as this is a database report writer, the data should be in the field if you connect to the database and the report is designed to retrieve that field.

If not, at least highlight and copy the cell data and then customer can paste it to the text box.

- there is no way to do this in the DHTML viewer. The viewer is essentially a picture representation

Either I don't understand the questions, or I think you are looking for a functionality that is not available(?).

Ludek

Former Member
0 Kudos

"The viewer is a picture presentation". That gives the answer.

Otherwise, there is no way to copy a cell data manually and paste it on text box on the form.

See, the user is viewing a 1000 line customer sales report on the viewer. This is a windows application. The user wants to get more details of a specific customer. He has the customer number on the report. Yes, he can type in the customer number on the customer inquiry screen and press enter. But, he is lazy to enter the number.

If I understand correctly, there is no way to copy (high light, CTL-C)

the data, right(?)

I am new to crystal and do you think this a limitation of the viewer? Any windows application, the basic built in is CTL-C?

Please advice

Former Member
0 Kudos

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.
            MessageBox.Show(msg);
        }

Former Member
0 Kudos

Note for others viewing this thread: This functionality is available as of Crystal Reports XI Release 2 after SP1 and MHF1 have been applied (at minimum). Earlier versions of the product and earlier patch levels of CRXI R2 won't have it.

Former Member
0 Kudos

Hi,

Would you like to use the drill down feature to get the same functionality rather than copy the customers number?

For this you need to Enable the Drill down feature of the Sections of the report. For Eg:

Right click on the Section (Page Header) -> Section Expert -> Enable the Hide Drill Down option.

Hope that helps.

Regards,

AG.

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks, TristaL

Drill Down - Please explain