An exception that is thrown because the value of a variable is outside the allowed range
Questions tagged [outofrangeexception]
272 questions
4
votes
1 answer
ArgumentOutOfRangeException on initialized List
It's throwing an ArgumentOutOfRangeException in the middle of the For loop, please note that I cut out the rest of the for loop
for (int i = 0; i < CurrentUser.Course_ID.Count - 1; i++)
{
CurrentUser.Course[i].Course_ID =…

Jarred Sumner
- 1,793
- 6
- 33
- 45
3
votes
4 answers
#1264 Out of range value fix?
When I try to insert the below into my MySQL
INSERT INTO `rooms` (`id`, `ip`) VALUES ('131213', '-259857341');
I fails with the follow error:
Warning: #1264 Out of range value for column 'ip' at row 1
I am looking around but haven't found how to…

Guapo
- 3,446
- 9
- 36
- 63
3
votes
3 answers
"Vector subscript out of range", at return statement?
My program raises a "vector subscript out of range" exception (EDIT: assertion) on a return statement. Well, it seems like it since it raises it exactly on that breakpoint.
Here is the function that causes it :
Matrix4 Perspective(float fov, float…

Torayl
- 57
- 6
3
votes
1 answer
F# Merge Sort - IndexOutOfRangeException when attempting to implement a match with structure
The overall code for my merge sort, looked something like this:
let remove array =
Array.sub array 1 (array.Length - 1)
let rec merge (chunkA : int[]) (chunkB : int[]) =
if chunkA.Length = 0 && chunkB.Length = 0 then [||]
else if…

Luke
- 107
- 4
3
votes
3 answers
SQL Server: How to automatically adjust an out-of-range value for a column when insert/update?
I am using MS-SQL Server 2014 on Windows 7.
In the database, I currently have a table named "STATUS" where a column is defined like:
DeviceSerial smallint
There are/will be more than 6k records in this table.
Unfortunately some devices were…

סטנלי גרונן
- 2,917
- 23
- 46
- 68
3
votes
4 answers
Getting out-of-range error when trying to create and populate a vector using a for loop (C++)
I'm trying to create a vector where each element is a multiple of 3 below 1000. I tried two ways, only one of which worked. The non-functioning way was:
int main() {
vector multiples_of_three;
for (int i = 0; i <= 1000/3; ++i)
…

user3677061
- 65
- 6
3
votes
1 answer
Using GMP to calculate very large Integers from formulas
I was having a hard time to figure out how to deal with a problem I encountered.
As a part of a complex formula, I need to calculate a part that quickly overflows double, i.e. results get up to ~ 1.59*10^(1331) (calculated with mathematica).
Of…

theuni
- 289
- 2
- 18
3
votes
3 answers
listview display error with List strings in C#
I have a listView1 in C# WinForms which displays 2 List
List pths;
List rec;
public void Disp ()
{
DisplayListInColumns(listView1, pths, 0);
DisplayListInColumns(listView1, rec, 1);
}
private…

Vivian Lobo
- 583
- 10
- 29
2
votes
1 answer
Column position '0' is out of range. The number of columns for this ResultSet is '3'
In a previous piece of code I received the exact same error I listed in the title.
I had a username validator in my code but forgot to include the following code:
password =ESAPI.validator().getValidInput("Login password", password, "Password",…

Turk
- 269
- 2
- 11
- 17
2
votes
1 answer
Adding Parent and Child Nodes in TreeView from Sql Server 2008
i want to add the parent and child nodes from sql server to treeview. i implemented some code. but i gets error "Index was out of range"
below is the code i am using to fill parent and child nodes.
protected void GetParentNodes()
{
…

Abbas
- 4,948
- 31
- 95
- 161
2
votes
1 answer
C#: How to fix this ArgumentOutofRangeExeception?
Making myself a password manager and I'm running into some problems with a segment of code. Whats supposed to happen is the application opens an xml file, and then populates a listview with the items contained in that xml document (the accounts).…

Stev0
- 605
- 11
- 29
2
votes
0 answers
Programming: Principles and Practice using C++ 2nd edition, Chapter 5 Drill - Program not throwing an exception when expected
In Stroustrup's book, the chapter 5 drill has a small program where you insert selections that have purposeful errors in order to better understand error handling. One of the inserts is as follows:
vector v(5); for (int i=0; i<=v.size(); ++i)…

Steve C
- 31
- 3
2
votes
3 answers
Python - Split Function - list index out of range
I'm trying to get a substring in a for loop. For that I'm using this:
for peoject in subjects:
peoject_name = peoject.content
print(peoject_name, " : ", len(peoject_name), " : ", len(peoject_name.split('-')[1]))
I have some…

SaCvP
- 393
- 2
- 4
- 16
2
votes
1 answer
Vector subscript out of range, error only shown in debug mode
Visual Studio Debug is showing the exception "Vector subscript out of range" (only debug mode) but I can't detect it. There's nothing wrong, it's selection sort algorithm.
Source code:
#include
#include
using namespace…

Danilo
- 175
- 1
- 11
2
votes
2 answers
std::string::substr throws std::out_of_range but the arguments are in limit
I have a vector of strings:
vector tokenTotals;
When push_back is called, a string of length 41 is stored and I must operate on each element of my vector and get two substrings, the first in range 0 to 28 and the second in range 29 to…

angelreyes17
- 81
- 1
- 1
- 5