473,385 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ArgumentOutOfRangeException was unhandled by user code

This is the error i Get

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

It points to this code

Expand|Select|Wrap|Line Numbers
  1.       if (!IsPostBack)
  2.             {
  3.                 localhost1.dbConnection dbConn = new localhost1.dbConnection();
  4.                 NameValueCollection Query = Request.QueryString;
  5.                 string[] sQuery = Query.GetValues(0);
  6.                 string[] RefRen = Query.GetValues(1);
This is the last error i need to solve to get my compleet application to work again but it all points to 1 webpage and i get different errors if i try different things so i dont now anymore what the best way is pleas somone help me i only need to solve this page error so my copmpleet application works

The error points to line number 5

But if i delete the ! before IsPostBack than it goes to this error almost the same code

Expand|Select|Wrap|Line Numbers
  1.             else
  2.             {
  3.                 localhost1.dbConnection dbConn = new localhost1.dbConnection();
  4.                 NameValueCollection Query = Request.QueryString;
  5.                 string[] RefRen = Query.GetValues(1);
  6.                 nieuw = dbConn.IsOfferteNieuw(RefRen[0].ToString());
Also the error poitns to line number 5

The weird thing is it only shows the error when i start debuging and that whont work but when i stop debugging the error is not is my Error List at the bottum
Nov 19 '08 #1
4 2892
r035198x
13,262 8TB
Better check the Count property of your NameValueCollection before trying to access elements that are not there.
Nov 19 '08 #2
Cud you point me in the right direction of how i can check that i lookd on the internet and tryd myself but i dont now how
Nov 19 '08 #3
r035198x
13,262 8TB
But everything you need is there in my post. Your NameValueCollection is called Query. I just told you that it has a Count property which you can use to check if GetValues(n) will succeed or not. For a value n, Count must be >= n+1.
Nov 19 '08 #4
Plater
7,872 Expert 4TB
any time you use a blatent index on any type or array or collection, you should alway first check that there are that many items in the array/collection
Nov 19 '08 #5

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

Similar topics

1
by: Brian | last post by:
I'm having intermittent trouble with a call to the Read method of the HttpWebResponse object. I get an ArumentOutOfRangeException claiming that deep down inside of the Read method, the count...
7
by: Dustin B | last post by:
Since this issue encompasses so many things - I have to generally post it I guess. I'm building an application for a Wireless PDA - when it is connected to the Network I tested a TCPListener &...
3
by: Pieter | last post by:
Hi, I have a Windows Forms application (VB.NET 2.0) which uses a Class Library in C#. The application runs fine, but when I run it in debug mode, I get several "A first chance exception of type...
1
by: ÀÏÆÅ»³ÔÐ6¸öÔ | last post by:
how can i override the "ArgumentOutOfRangeException" or catch it in my dorpdownlist?
0
by: Martin Henke | last post by:
Dear all, I've got a problem with my custom combo box. When I select an entry from it, then I get the error message: "An unhandled exception of type 'System.ArgumentOutOfRangeException'...
0
by: Mike | last post by:
Hi, I have a collection object bound to a data grid, after I remove an item from the collection, the minute I click on the datagrid I get an error saying the specified argument was out of the...
1
by: =?Utf-8?B?V2VzdGU=?= | last post by:
I am throwing the ArgumentOutOfRangeException in my code as shown below throw new ArgumentOutOfRangeException("value", "Value must be 0"); my catch block is below ...
1
by: sanghamitra das | last post by:
We have developed a web application in which we are using login user(as a array structure) in session variable using HttpContext for some purpose. The session is availabe in the same project...
6
by: sinhzun | last post by:
Hi everybody, I have a trouble with ArgumentOutOfRangeException. When I type a French word in an AutoCompleteComboBox then submit it to add new record to database, the combo box throw an exception: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.