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

You can work with crystal reports using Reporting tools in VS toolbox it'd help you a lot, try it!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.