0

Hi everybody,

I have a VB 2005 (Express) application with SQL 2005 database; a report (named 'c:\Items.rpt') already designed and set to "Items" table.

When I preview this report from Crystal Reports, it shows data correctly.

How can I show it from within VB code depending on its default dataset and showing all records?

Thanks for help

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by Ramy Mahrous
0

Hi Ramy, and thanks for your reply.

I tried the following code, but nothing happened (no errors but no output as well):

Dim RptPath As String
RptPath = "C:\Items.rpt"

If Not IO.File.Exists(RptPath) Then
       Throw (New Exception("Unable to locate report file:" & vbCrLf & RptPath))
End If

Dim rptDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rptDocument.Load(RptPath)

Dim rptViewer As New CrystalDecisions.Windows.Forms.CrystalReportViewer
rptViewer.ReportSource = rptDocument
rptViewer.Show()

As I said, nothing happened at all. Am I missing something?

Thanks

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.