Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Crystal Report from file

Status
Not open for further replies.

wadewilson1

Programmer
Sep 10, 2002
23
0
0
US
Does anyone know how to open a crystal report that is not part of the "project/solution" in the CrystalViewer?

I've tried mulitple things and I can't find a method to call to allow me to do it.

Thanks in advance.
 
You can do it like this:

create a reference to CrystalDecisions.CrystalReports.Engine
CrystalDecisions.Shared


Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim CR As New ReportDocument
Dim values(0) As String
Dim ds As New DataSet
Dim reportPath As String

reportPath = "c:\simpleReport.rpt"
CR.Load(reportPath)

values(0) = "employee1"
ds.Tables.Add("employeeTable")
ds.Tables(0).Columns.Add("employee_sid")
ds.Tables(0).Rows.Add(values)
CR.SetDataSource(ds.Tables("employeeTable"))
CrystalReportViewer.ReportSource = CR
End Sub
End Class
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top