Reputation:
I hope someone can help me. In short, I have this little code I can't replace "Path from my pc" with a string/textbox in any way
The intention would be this:
enumerator = SpotifyBox.Text.Split.GetEnumerator
It doesn't give me errors, but it doesn't work as it should once the button starts
Dim enumerator As List(Of String).Enumerator = New List(Of String).Enumerator()
Dim class70 As Action(Of String())
ThreadPool.SetMinThreads(40, 40)
Dim strArrays As List(Of String()) = New List(Of String())()
Try
Try
enumerator = File.ReadLines(Path from pc).ToList().GetEnumerator()
While enumerator.MoveNext()
Dim current As String = enumerator.Current
If (If(Not current.Contains(":"), True, String.IsNullOrEmpty(current))) Then
Continue While
End If
strArrays.Add(current.Split(New Char() {":"c}))
End While
Finally
DirectCast(enumerator, IDisposable).Dispose()
End Try
int_5 = strArrays.Count
Catch exception1 As System.Exception
End Try
Upvotes: 0
Views: 52
Reputation: 54417
That is some crazy code and the question you're asking is not the question you need an answer to. Based on what you have posted, it seems that you have a file path in a TextBox
named SpotifyBox
and you want to read the lines from that file with some processing. In that case, get rid of all that craziness and do this:
Dim filePath = SpotifyBox.Text
Dim records As New List(Of String())
For Each line In File.ReadLines(filePath)
If line.Contains(":") Then
records.Add(line.Split(":"c))
End If
Next
That's it, that's all. You pretty much never need to create an enumerator directly. Just use a For Each
loop.
Upvotes: 1