locked
Crystal Report Viewer Print Results RRS feed

  • Question

  • I have a Crystal Report Viewer in my project. The control works great. But now, I need to determine if a document was printed or not from the Report Viewer print dialog. I have an event on the Print Button of the viewer that I found elsewhere. Now I need to get the value that says the document was printed or it was cancelled. Does anyone know how to get that value from the Crystal Report Viewer?

    Here is the code to create a click event to the print button.

    // Get the print tool item
    foreach (Control control in crystalReportViewer2.Controls)
    {
           if (control is System.Windows.Forms.ToolStrip)
           {
               ToolStripItem tsItem = ((ToolStrip)control).Items[1];
               tsItem.Click += new EventHandler(tsItem_Click);
           }
    }

    The print dialog comes up before my event is fired. So how can I get the action taken on the Print Dialog?

    Thanks

    Liz

    Monday, May 14, 2012 8:04 PM

Answers

  • Not worked with Crystal Reports for a long time but a quick search came up with the following article that shows you how to invoke a custom method when an item on the toolbar in the viewer is clicked. 

    http://www.codeproject.com/Articles/238093/Invoke-a-custom-method-when-Crystal-Report-Viewers

    Instead of allowing the normal print dialog to be displayed by default, maybe you can override the default behaviour and show a print dialog yourself. If you call this using the ShowDialog() method you can see the result (DialogResult.OK or DialogResult.Cancel). 

    I don't know if you can pass a crystal report document to a standard windows print dialog or not


    • Marked as answer by Bob Shen Tuesday, May 29, 2012 7:49 AM
    Tuesday, May 15, 2012 9:09 AM