on 04-02-2013 5:28 PM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.