Thread: Question Problem with Array.IndexOf
View Single Post
  #4 (permalink)  
Old 06-26-2009, 4:52 PM
MattP MattP is offline
VB.NET Forum Idol
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Feb 2008
Location: USA
Posts: 877
Reputation: 500
MattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond reputeMattP has a reputation beyond repute
Default

What is Request.QueryString("i") returning?

Array.IndexOf will return -1 if you don't have a match (which you're incrementing by 1)

Example using strings:

Code:
		Dim strings() As String = New String() {"Document1", "Document2", "Document3", "Document4", "Document5"}

		'Returns -1
		MessageBox.Show(Array.IndexOf(strings, "Document10"))

		'Returns 2
		MessageBox.Show(Array.IndexOf(strings, "Document3"))
Reply With Quote