Link to home
Start Free TrialLog in
Avatar of mbarazi
mbaraziFlag for United States of America

asked on

Crystal reports causes an error invalid index after being opened and having "any" change applied and saved

I have a windows service written in vb.net 1.1 using vs 2003. I also have a crystal reports template version 8.0. I have recently been asked to modify this report by shifting a text object on the report about a centimeter over. I have done this and now the application throws an invalid index error on the following line of code :

.ReportObjects("TrayDisclaimerUpper").SetText(strUpper)

The code in the service simply refrences report objects by name and sets text string for those text objects on the report template. I have not changed anything on the report. On the developement machine I have both crystal 8 and crystal 10 installed. the exact error I get is:  
Run-time exception thrown : System.Runtime.InteropServices.COMException - Invalid index
If mReportType = mdlGlobalVariables.rptReportType.rptCarton Then
            'TIM 11780 cmj 9/8/05 - removed subreport code
            With mReport.Sections("D")
                .ReportObjects("TrayDisclaimerUpper").SetText(strUpper)
                .ReportObjects("TrayDisclaimerLower1").SetTex(strLower1)
                .ReportObjects("TrayDisclaimerLower3").SetTex(strLower3)
End With
        Else
            mReport.Sections("Header1").ReportObjects("TrayDisclaimerUpper").SetText(strUpper)
            mReport.Sections("DisclaimerTrayLower1").ReportObjects("TrayDisclaimerLower1").SetText(strLower1)
            mReport.Sections("DisclaimerTrayLower2").ReportObjects("TrayDisclaimerLower2").SetText(strLower2)
            mReport.Sections("Footer").ReportObjects("TrayDisclaimerLower3").SetText(strLower3)
        End If

Open in new window

Avatar of Mike McCracken
Mike McCracken

Are you changing the report in the CR8 designer or inside the VB.Net application?
If inside the application, make sure it is referencing the V CR8 dlls and not the CR10 dll.

mlmcc

Avatar of mbarazi

ASKER

I am changing the report from within crystal 8.0. I checked the dlls refrenced and I have CRAXDRT which is crystal design time run library ver8.0. The application seems to work fine as long as I don't open the report and save from crystal 8. I did read something in our documentation to open up the crystal designer in VB6 but I don't know what they mean by that. Thanks.
DO you have Crystal installed on your machine?

Look for SEAGATE SOFTWARE in Program Files

mlmcc
Avatar of mbarazi

ASKER

Yes I have seagate installed and it's version 8.0. Thanks
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mbarazi

ASKER

Thanks a lot for the help, this was very fraustrating. I have found the designer and changed the reports and then saved it to crystal.
Avatar of mbarazi

ASKER

The crystal report was designed using the designer from vb6. You can see if you have this by opening a standard form project, right click form and go to add and you should see crystal reports 8 as an option. Although I could view the report from within seagate crystal 8 and change it. I had to open the report from VB6 crystal designer and modify the report there and then export the report to crystal format. Otherwise I would loose all my refrences to the text objects in the report if I save in any other application. Thanks.