Questions tagged [outofrangeexception]

An exception that is thrown because the value of a variable is outside the allowed range

272 questions
0
votes
0 answers

Preventing "out of range" exceptions when trimming in C++

I'm attempting to trim the strings that I read in from a file. I read the string, trim it, then do my stuff with it. As I read through the file, I eventually reach the end, meaning the endpos+1 results in an out of range exception. What would be the…
George G
  • 61
  • 1
  • 8
0
votes
2 answers

Error C#: Index was out of range. Must be non-negative and less than the size of the collection

I've got a problem with creating objects in a for loop and adding them in a list. The program starts with "How much you want to add?" and whatever I write it shows me a message : Index was out of range. Must be non-negative and less than the size…
Vanessa Va
  • 21
  • 1
  • 1
  • 3
0
votes
2 answers

DataTable ArgumentOutOfRangeException

The code below works exactly as it should when it runs against my DataTable the first time. The data table is loaded, it updates all of the column data specified using the string that is specified. Everything is closed (and presumably cleared)…
user2152085
0
votes
1 answer

std::vector out of range for min-heap: C++

I've neglected to work on this code (or any other coding projects) for a while, so while I know what is basically wrong with the code, I've been having a hard time finding exactly where the vector is going out of range. I've been running gdb on it…
Anonymous
  • 43
  • 6
0
votes
1 answer

listview- System.ArgumentOutOfRangeException

I have a listview which has 7 columns. I want to add information on each column, but when it reaches the subitem 2 from the listView I get a System.ArgumentOutOfRangeException even though I have that subitem. Any idea why I get this error? I've…
0
votes
0 answers

std::out_of_range for C++ code

I am having errors running this code. While executing it gives out an error like- terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr Any ideas on what I am doing wrong here? #include…
Peter
  • 17
  • 3
0
votes
1 answer

String of bits to byte. Value out of range - converting error java

I need to convert the set of bits that are represented via String. My String is multiple of 8, so I can divide it by 8 and get sub-strings with 8 bits inside. Then I have to convert these sub-strings to byte and print it in HEX. For example: String…
Sergey Lotvin
  • 179
  • 1
  • 14
0
votes
2 answers

C# list count with data validation

Thanks for your feedback. I'm still getting an out of range exception. I'm debugging but can't understand why I'm getting the exception. If an int is higher than a certain other int it should work. Does it have anything to do with the length.Count?…
Max
  • 488
  • 8
  • 19
0
votes
2 answers

C++, trying to write an object reader, error when trying to get data from one vector

I am trying to write a really simple obj file reader, that writes all vertice values in order from the obj file into one vector (already done that), and also writes vertice values referred by face values from the obj file in another vector, for…
Marcin
  • 35
  • 3
0
votes
1 answer

Getting error on multiselect ListBox in VB.Net ASP.Net Webform

I have a webform that has two multiselect ListBoxes and a button. The button moves the selected items from one ListBox to the other, while checking for duplicates. Unfortunately I am getting an out of range exception on the last iteration of the…
todd.pund
  • 689
  • 2
  • 11
  • 36
0
votes
1 answer

Why do I get an out_of_range exception here?

Currently doing a project at uni where at first I need to de-hyphenate a string, seemed pretty simple however when i run the program it has an error WeirdPuncProgram.exe: Microsoft C++ exception: std::out_of_range at memory location 0x004EF898 It…
0
votes
1 answer

Objective c Out of range exception

I am trying to delete the highlighted text inside of a uitextview. For example If I had the text "I am going home" If I want to delete the word "going" I get this error 'NSRangeException', reason: '-[__NSCFString substringWithRange:]: Range {15,…
0
votes
2 answers

System.ArgumentOutOfRangeException on Console.CursorLeft = X

I got this Exception and I really don't understand why. My Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SomeColors { class Program { public…
user5375879
0
votes
1 answer

Why am I getting an Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 12 error?

at java.lang.String.charAt(String.java:658) at TelephoneNumberTranslator.correctFormat(TelephoneNumberTranslator.java:97) at TelephoneNumberTranslator.getPhoneNumber(TelephoneNumberTranslator.java:61) at…
andrews
  • 1
  • 2
0
votes
1 answer

DataGridView Cell Index Problem

Okay I have a problem with my Windows Application. My DataGridView consists of the following columns: ProductName, Qty, Price, Subtotal. So I am assuming that the Cell Indexes of these are respectively as follows: 0, 1, 2, 3. However, whenever I try…
Smiley
  • 3,207
  • 13
  • 49
  • 66