Click here to Skip to main content
14,739,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends i am getting an error for "Index was outside the bounds of the array."
for the following code which is in bold plesae needed help to resolve the error:

cryRpt.Load("C:\sachin\AutoCrystal1\AutoCrystal1\Daily MIS 28-02-13.rpt")
       cryRpt.SetDatabaseLogon("sa", "admin-123", "testvm", "sgujdt")
       cryRpt.SetParameterValue("@date", Date.Now)
       cryRpt.SetParameterValue("@fromdate", date2, "Sub Cumulative MIS")
       cryRpt.SetParameterValue("@date", date3, "Sub Cumulative MIS")
       cryRpt.SetParameterValue("@fromdate", date4, "Diff_mis")
Mike Meinz 28-Jun-13 6:26am
What is SetParameterValue?
Use the Visual Studio Debugger to step through SetParameterValue to see where the error occurs.

Why set @date and @fromdate twice?
sachin bhise 28-Jun-13 6:44am
ok actually i have one report in which i have a sub report and in that sub report i have another sub report so @fromdate,@date are in both sub report that's why @date and @fromdate twice

1 solution

sachin bhise 28-Jun-13 7:07am
thanks Maciej Los.
Maciej Los 28-Jun-13 7:10am
You're welcome.
If your problem is solved, please, mark this answer as a solution (green button).
sachin bhise 28-Jun-13 7:24am
sure...i am checking the second link in the solution but its not showing the solution to the problem Maciej do u have any other link?
sachin bhise 28-Jun-13 7:53am
Dim subcryRpt As New ReportDocument
subcryRpt = cryRpt.OpenSubreport("Sub Cumulative MIS")
subcryRpt.SetParameterValue("@fromdate", date2, "Sub Cumulative MIS")
subcryRpt.SetParameterValue("@date", date3, "Sub Cumulative MIS")

i did according to the syntax mentioned in the solution but it's giving error that not supported within subreport
Maciej Los 28-Jun-13 8:07am
try this:
subcryRpt.SetParameterValue("fromdate", date2, "Sub Cumulative MIS") (without @) ;)
sachin bhise 29-Jun-13 0:13am
still its giving error not supported within sub reports
Maciej Los 29-Jun-13 8:31am
Which document/report do you open first? The sequence should be: subreport, subreport, main report.
sachin bhise 1-Jul-13 8:08am
ok maciej thnx..
Maciej Los 1-Jul-13 11:19am
You're welcome ;)

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