Set Crystal Report path which is in other Folder (Directory) using C# and VB.Net in Windows Application

Last Reply 6 months ago By dharmendr

Posted 6 months ago

I created separate folder for crystal report in windows form and structure looks like this 

myProject -> AB -> Crystal Report -> rptStuData

rptStuData is crystal report which is created by using wizard

Now I want to display the data in the rptStuData.

guide me how i can do that?

Posted 6 months ago

Hi smile,

You have to manually load the report in ReportDocument using the path.

For crystal report refer below article.

Basic Crystal Report Tutorial with example in Windows Forms (WinForms) Application using C# and VB.Net

Change the Form1_Load event code with below.


private void Form1_Load(object sender, EventArgs e)
    Customers dsCustomers = GetData();
    ReportDocument crystalReport = new ReportDocument();
    crystalReport.Load(Application.StartupPath.Replace("bin\Debug","") + "AB\\CrystalReport\\rptStuData.rpt");
    this.crystalReportViewer1.DisplayGroupTree = false;
    this.crystalReportViewer1.ReportSource = crystalReport;


Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
    Dim dsCustomers As Customers = GetData()
    Dim crystalReport As ReportDocument = New ReportDocument()
    crystalReport.Load(Application.StartupPath.Replace("bin\Debug","") & "AB\CrystalReport\rptStuData.rpt")
    Me.crystalReportViewer1.DisplayGroupTree = False
    Me.crystalReportViewer1.ReportSource = crystalReport
End Sub