Skip to Content

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

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

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

Former Member
Not what you were looking for? View more on this topic or Ask a question