keyongtech


  keyongtech > dotnet.languages.* > dotnet.languages.vb > 03/2009

 #1  
03-18-09, 12:12 AM
douglas
I am new to using Visual Basic.Net 2005. I want to pass a crystal report
object between two different click events. Below is my my code the way it
currently exists.
Can you tell me how to change the code so that the click events would be
aware of the crystal report object?

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class cryClass
Dim cryRpt As New ReportDocument
Dim excelFile As String = "c:\crystalExport.xls"

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim cryRpt As New ReportDocument
cryRpt.Load("C:\crystalreport.rpt")
CrystalReportViewer1.ReportSource = cryalRpt
CrystalReportViewer1.Refresh()
Try
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions ()
Dim CrFormatTypeOptions As New
CrystalDecisions.Shared.ExcelFormatOptions()
CrDiskFileDestinationOptions.DiskFileName = excelFile
CrExportOptions = cryalRpt.ExportOptions


With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.Excel
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
cryalRpt.Export()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
 #2  
03-18-09, 04:08 AM
Mr. Arnold
"douglas" <douglas> wrote in message
news:da32
> I am new to using Visual Basic.Net 2005. I want to pass a crystal report
> object between two different click events. Below is my my code the way it
> currently exists.
> Can you tell me how to change the code so that the click events would be
> aware of the crystal report object?


So why can't you make a Sub or a Function that deals with the object and you
can then call either one to create the object or do whatever to the object
from anywhere in the code, like two different events?
Similar Threads
Passing dates to a Crystal Report

I have a report in a form and it's running fine. I would like to have the same report filter between dates passed form a DateTimePicker to show all records between the two...

Passing of Parameter from VB 6 to Crystal Report

Hi! I am new to crystal report, so I need help. My plan is this, I will create a form that will pass the value from a text box to Crystal. From Crystal report, I create a...

Crystal report porblem (dataset passing, blank report, and table b

What I want: I want to build a table that looks like the following description : ---------------------------------------------------------------------------- |Data in rows...

passing parameter from VB.NEt to crystal report

Hi, I want to add two parameters from VB.NET to crystal report at run time in order to print it on the report Can any one help me in this regard? Reny

Passing a parameter from VB to a Crystal Report

Okay.... I'm sure this can be done but I'll be doggone if I can figure it out. I want to pass a parameter to a CR from VB. Hints? Thanks Suzette


All times are GMT. The time now is 07:27 AM. | Privacy Policy