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
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)
Can anyone out there help me Please?
I have been trying for two months.