473,507 Members | 9,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Index was out of range

109 New Member
Any one knows how to fix this isssue?
this is the error on line: 161

Expand|Select|Wrap|Line Numbers
  1. Index was out of range. Must be non-negative and less than the size of the collection.
  2. Parameter name: index 
  3. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  4.  
  5. Exception Details: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
  6. Parameter name: index
  7.  
  8. Source Error: 
  9.  
  10.  
  11. Line 159:            for (int i = 0; i <= qci.Count;i++ )
  12. Line 160:            {
  13. Line 161:                int min = Convert.ToInt32(qci[i]);
  14. Line 162:                if (max < min)
  15. Line 163:                    max = min;
  16.  
  17.  
Thank You,
Sep 28 '07 #1
6 1547
priya05
7 New Member
Hi,

This error comes when u don't pass the parameters properly that are required .
Sep 29 '07 #2
ngokulkumar
4 New Member
can u tel me the type of variable qci ? i need details regarding thi error.. so that il try to help u
Sep 29 '07 #3
thaond
2 New Member
hi !
I think that the error is : for(int i=0; i<= qci.Count; i++)
{
..............
}
for example : int[] a={1, 2, 3, 4, ,5} has 5 elements, i can't access 6th element.
for(int i=0; i< a.Length; i++)
{
...............(i=0, i=1, i=2, i=3, i=4) has total elements = 5.
}
if I access the 6th element, means : i=5
-> Exception : ArgumentOutOfRangeException
bye!
Sep 29 '07 #4
arial
109 New Member
Thank you all for your response.

qci is of type varchar in MS sql database.

Thank You,
Oct 1 '07 #5
Plater
7,872 Recognized Expert Expert
The problem comes from i <= qci.Count

.Count is the total number in there, not the highest index.
For example if the .Count was = 3, then the index values are [0],[1],[2], you on the other hand are trying to reference [3], which doesn't exist, so you get the index out of range.
Change it to:
i<qci.Count
Oct 2 '07 #6
arial
109 New Member
Thanks Plater,

I figure that out.

Can any one point out for a good tutorial to use crystal report on .net website using c#?

Thanks,
Oct 2 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

14
2220
by: Craig O'Shannessy | last post by:
Hi all, Just thought I'd mention that I really think this problem needs to be fixed. I I'm patching the 7.4RC1 JDBC drivers as we speak due to this optimiser bug, and it's the third time...
29
5416
by: shmartonak | last post by:
For maximum portability what should the type of an array index be? Can any integer type be used safely? Or should I only use an unsigned type? Or what? If I'm using pointers to access array...
2
16119
by: kscdavefl | last post by:
When I run the following code: private void applicationPermissionGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if (e.Item.ItemType ==...
1
2505
by: Clark Choi | last post by:
I ran the sample application called Petstore from msdn. Everything went fine until I tested Update button on the web form to update the database through Datagrid. I have been searching the web to...
14
22525
by: micklee74 | last post by:
hi say i have string like this astring = 'abcd efgd 1234 fsdf gfds abcde 1234' if i want to find which postion is 1234, how can i achieve this...? i want to use index() but it only give me the...
0
8048
by: ssims | last post by:
I've got a GridView that's sorted by a stored procedure with ROW_NUMBER: PROCEDURE dbo.GetCalendarsByStatusIDPaged ( @startRowIndex int, @maximumRows int, @statusID int ) AS
85
4223
by: Russ | last post by:
Every Python programmer gets this message occasionally: IndexError: list index out of range The message tells you where the error occurred, but it doesn't tell you what the range and the...
2
3707
by: Georgy Panterov | last post by:
I am a relatively new python user. I am writing an economic simulation of acard-game. The simulation runs fine for a few iteration but then it gives an error of "list index out of range." The...
1
2992
by: =?Utf-8?B?SkI=?= | last post by:
Hello As I debug the C# code with a break point and by pressing F11 I eventually get a message stating: ContextSwitchDeadlock was detected Message: The CLR has been unable to transition from...
6
18690
by: shashi shekhar singh | last post by:
Respected Sir, I am facing problem when i try to deploy my website on iis 7.0 on test page. i have to display some .mht files on iframe in gridview and error looks like below, Server Error in...
0
7109
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7029
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.