All Questions

120
votes
3answers
82413 views

What is an IndexOutOfRangeException / ArgumentOutOfRangeException and how do I fix it?

I have some code and when it executes, it throws a IndexOutOfRangeException, saying, Index was outside the bounds of the array. What does this mean, and what can I do about it? Depending on cl...
16
votes
1answers
116198 views

What is an "index out of range" exception, and how do I fix it?

I'm getting one of the following errors: "Index was out of range. Must be non-negative and less than the size of the collection" "Insertion index was out of range. Must be non-negative and less tha...
1
votes
2answers
69 views

How to build a new dictionary with values from two different dictionaries having same keys

Let's say we have two dictionaries with the following key pair values: Dictionary 1 : [ {1,abc} {2,cde} {3,efg} ] Dictionary 2: [ {1,123} {2,234} {3,345} ] I want to create a dictionary as follows...
2
votes
1answers
71 views

IndexOutOfRangeException on multidimensional array despite using GetLength check

I am using the following code to read values from an Excel spreadsheet: // Start with passed int lastPassRow = sheets[passedVehicles].GetLength(0); for (int i = 1; i < lastPassRow; i++) { // E...
1
votes
1answers
6461 views

Getting "Index was out of range" exception in DataGridView when clicking header

I am using a DataGridView to display my data from a SQLite database. One column is a directory to open pdfs assigned to the row. The code works but, every time I click on the column title, it gives me...
0
votes
1answers
515 views

How to resolve an IndexOutOfRangeException on bit value?

I'm reading back a bit value from an SQL table, and casting as a boolean value to map to a boolean model value. But when I read back the IsPDLChecked bit field and initialise as false, I get an index...
0
votes
3answers
1158 views

"list index out of range" when try to output lines from a text file using python

I was trying to extract even lines from a text file and output to a new file. But with my codes python warns me "list index out of range". Anyone can help me? THANKS~ Code: f = open('input.txt', 'r'...

Previous Next