Thread: Question Problem with Array.IndexOf
View Single Post
  #1 (permalink)  
Old 06-26-2009, 1:40 PM
Coffer Coffer is offline
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jun 2009
Age: 30
Posts: 5
Reputation: 0
Coffer is on a distinguished programming path ahead
Default Problem with Array.IndexOf

Hello!

I have a tricky little problem. I want to retrieve the index of a current occurence inside an array. I use this code:

Code:
Array.IndexOf(myArray, Request.QueryString("i"))
This code ALWAYS returns 0 even if the array contains 10 indexes... I read somewhere in this thread that Array.IndexOf returns the very first occurence of a value inside the array. Does that mean that Array.IndexOf always should return 0? Since all fields in the array are unique it should return 9 if Request.QueryString("i") equals to a value in the 9th position of the array, right? Or am I thinking wrong?

If I am thinking wrong, how should I retrieve the index of a current request from the array?

// Kristofer
Reply With Quote