Thread: Question Problem with Array.IndexOf
View Single Post
  #3 (permalink)  
Old 06-26-2009, 3:48 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

To me the problem still occurs. This is the code I am using...

Code:
Dim NewStr As String = ""
Dim Directory As New DirectoryInfo(Request.QueryString("f"))
Dim File As FileInfo

For Each File In Directory.GetFiles("*.jpg")
     NewStr += File.Name.Substring(0, File.Name.Length - 4) & ","
Next

Dim myArray() As String = Split(NewStr.Substring(0, NewStr.Length - 1), ",")

' This is where the error occurs... it ALWAYS returns IndexOf = 0
Dim CurrentIndex As Integer = Array.IndexOf(myArray, Request.QueryString("i")) + 1
lblcuridx.Text = "index of " & Request.QueryString("i") & ".jpg is " & CurrentIndex
What am I doing wrong?
Reply With Quote