Click here to Skip to main content
15,064,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sometimes crystal report give me an error like "LOAD REPORT FAILED"

but not all time my code is below i load my crystl report at temp folder i am not giving crystal report path at line "rpt=new cryName" - cryName is my Crystal report Name when i write this type of code and run crystal report load on temp folder on same pc but some time it gives error like report load errro please help me


waiting for your valuable reply

What I have tried:

rpt = New cryName

        Dim dt As New DataTable("PhoneBook")
        Dim dr As DataRow

        dt.Columns.Add("Label1", System.Type.GetType("System.String"))
        dt.Columns.Add("Label2", System.Type.GetType("System.String"))
        dt.Columns.Add("Label3", System.Type.GetType("System.String"))
        dt.Columns.Add("Label4", System.Type.GetType("System.String"))


        Try
            For i As Integer = 0 To dgvData.Rows.Count - 1
                dr = dt.NewRow
                dr("Label1") = dgvData.Item(0, i).Value.ToString
                dr("Label2") = dgvData.Item(1, i).Value.ToString
                dr("Label3") = dgvData.Item(2, i).Value.ToString
                dr("Label4") = dgvData.Item(3, i).Value.ToString


                dt.Rows.Add(dr)
            Next
            rpt.SetDataSource(dt)

         
            CrystalReportViewer1.ReportSource = rpt

          
        Catch ex As Exception
          
        End Try
Posted
Updated 6-Jan-21 5:04am
v2
Comments
Richard MacCutchan 7-Feb-20 4:17am
   
What is contained in your DatagridView?
hareshdgr8 7-Feb-20 4:35am
   
it contains with Customer Name, Phone No., Email Id , Other Comments
CHill60 7-Feb-20 4:19am
   
Try putting some meaningful code in
Catch ex As Exception
End Try
- like displaying the error message perhaps?
hareshdgr8 7-Feb-20 4:37am
   
sir it only giving me an error like "Load Report Failed" but after some time i run it work perfectly dont know what is the issue.
hareshdgr8 7-Feb-20 4:35am
   
sir try-catch is properly just here copy paste remaining
MadMyche 7-Feb-20 6:32am
   
What is the data source? If it is from a database is the query optimized and are the tables indexed?
hareshdgr8 7-Feb-20 22:48pm
   
Datasource is used to set data table value into crystal report rpt is object of crystalreport file "dim rpt as new cryName"

1 solution

   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900