Click here to Skip to main content
13,046,533 members (69,616 online)
Rate this:
Please Sign up or sign in to vote.
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")
Posted 28-Jun-13 0:10am
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 28 Jun 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100