Click here to Skip to main content
11,921,835 members (66,047 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
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 1: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
0 OriginalGriff 538
1 Dave Kreskowiak 260
2 Sergey Alexandrovich Kryukov 173
3 phil.o 170
4 RyanDev 134
0 OriginalGriff 7,036
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,286
3 George Jonsson 2,840
4 Suvendu Shekhar Giri 2,216

Advertise | Privacy | Mobile
Web02 | 2.8.151120.1 | Last Updated 28 Jun 2013
Copyright © CodeProject, 1999-2015
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