cancel
Showing results for 
Search instead for 
Did you mean: 

How to create own button in CrystalReportViewer1?

Former Member
0 Kudos

How to create own button in CrystalReportViewer1?

I did created button, but when I run the report it doesn’t
show up. I am Vb 2008 and CrystalReport 8

I have two forms main and report. Report review works and
prints fine. I need to update in SQL if report is printed on which date.

 

I try this:

'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

It never went to PrintButton_Click.

Now, I created button and name is PrintButton, but PrintButton doesn’t show up in CrystalReportViewer1

Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PrintButton.Click

Dim dialog As New PrintDialog

          dialog.UseEXDialog = True

        dialog.AllowSomePages = True

           If dialog.ShowDialog() = DialogResult.OK Then

Dim objRpt As ReportDocument = CType(Me.CrystalReportViewer1.ReportSource, ReportDocument)

objRpt.PrintOptions.PrinterName = dialog.PrinterSettings.PrinterName

objRpt.PrintToPrinter(1, False, 0, 0)

              PrintedDate()

          Else

              MessageBox.Show("print cancel")

              Return

          End If

      End Sub

Can anyone out there help me Please?
I have been trying for two months.

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Same query as:

http://scn.sap.com/thread/3336938

Locking this thread

- Ludek

SCN Moderator

Answers (0)