cancel
Showing results for 
Search instead for 
Did you mean: 

how to catch the print event When user Clicks Print Button In Crystal Report Viewer?

Former Member
0 Kudos

i created a report using vb.net 2008 and crystal report viewer. if user print the report, I need to recored it.

user click on print button and print dialog show up with default print then user can click print or cancel.

in the report if user click print button, then program should wait for user next action?

if i print, vb debug does not go through? why? how to fix it inde?

thank you

'find the print button control and attach an event to it
                For Each Obj As Object In myToolStrip.Items
                    If TypeOf Obj Is ToolStripButton Then
                        'Adding a handler for our propose  
                        Dim b As ToolStripButton = CType(Obj, ToolStripButton)
                        If b.ToolTipText = "Print Report" Then
                            AddHandler CType(Obj, ToolStripButton).Click, AddressOf printButton_Click
                        End If

                    End If
                Next

Private Sub printButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        If updateReportStats Then

            Try

                    If Windows.Forms.DialogResult.OK Then
                        'Put your stuff here
                        UpdatePrintDate()
                        MessageBox.Show(" print")
                        'Else
                        'Windows.Forms.DialogResult.Cancel()
                    End If
               
            Catch ex As Exception

            End Try
        End If
       
    end sub

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hello Sunny

Entering the search term 'event crystal net', in the search box in the top right corner of this web page returns the following KBA:

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

Please see if the KBA helps. (Make sure you're on SP5 for CR 2008)

- Ludek

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

Former Member
0 Kudos

this did not help. i did try this couple days ago

Former Member
0 Kudos

i want to record date and time printed to database.

Normally "when user click on the crystal report viewer control print button . print dialog box appear". here user print the report. i want to insert the printed date and time to database.

is it possible to write code for the print button of the crystal report viewer control.

i couldn't find a solution for it. plz anyone help me with this code problem.

former_member183750
Active Contributor
0 Kudos

Oh, OK. Thanks for letting me know you tried that possible solution.

Your only other option is to hide the print button on the viewer, create your own print button and do what ever you need there.

- Ludek

Former Member
0 Kudos

how can create own button?

i can add button on report design, but it did not show in review. why?

i can showprintbutton is false that works.

Answers (0)