Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unhappy Unanswered: Open Crystal Report Using VB.Net

    This is a really basic thing I know.. but I just can't do it.

    I am using Visual Basic .Net.

    I have a Crystal Report called creClubChamp.rpt. I used the wizard to create this and attached tables from an Access db located in the bin folder for the solution.

    I have a Reports Menu form (frmReportsMenu.vb) which has a button on it (btnClubChampReport).

    I just don't know how to combine them all to view the report? Do I need a CrystalReportViewer Control? If so, do I need one of these for each of my three reports, or is the one Viewer control used for all the reports in a solution?

    I'm guessing that the btnClubChampReport_Click Event should do something like this:

    Dim objViewClubChampReport As New creClubChamp.rpt
    objViewClubChampReport.ShowDialog() (or print preview or something?)

    What namespaces do I need to import? I currently have:

    Option Strict On
    Option Explicit On
    Inherits System.Windows.Forms.Form

    Thanks for your help. I feel as though I'm halfway to understanding all this so if you can just help me understand the other half it would be appreciated!


  2. #2
    Join Date
    Oct 2011

    View Crystal Reports from .Net

    Public Class Form1

    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
    Dim oApp = New CRAXDRT.Application
    Dim oReport As CRAXDRT.Report
    oReport = oApp.OpenReport("C:\temp\reportname.R01.rpt", 1)

    With oReport.Database.Tables(1).ConnectionProperties
    .Add("Provider", "SQLOLEDB.1")
    .Add("User ID", "UserName")
    .Add("Password", "Password")
    .Add("Initial Catalog", "Database")
    .Add("DSN", "DSNName")

    End With

    AxCrystalActiveXReportViewer1.ReportSource = oReport

    End Sub

    Private Sub AxCrystalActiveXReportViewer1_Enter(sender As System.Object, e As System.EventArgs) Handles AxCrystalActiveXReportViewer1.Enter

    End Sub
    End Class

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts