I need help in determining the problem in my code. I can retreive all items in my notepad but when I am adding them up in my listbox, and trying to print them in the console. I can only display two strings. I don't know why. My string is a combination of a name, space & score. ex: "luke 300". That is the pattern of all strings per line in my text file. I am separating the name and the score using space as the indicator. When ever a space is found, string before and after the space is retrieved and added to the listbox. HELP PLEASE!
Here is my code:
Here is my code:
scorelist = New ArrayList reader1 = My.Computer.FileSystem.OpenTextFileReader(My.Application.Info.DirectoryPath & "\scores.txt") stream = reader1.ReadLine While stream IsNot Nothing scorelist.Add(stream) stream = reader1.ReadLine End While x = 0 y = 0 While x <= scorelist.Count - 1 streamstring = CStr(scorelist.Item(x)) While y <= streamstring.Length - 1 If streamstring(y) = " " Then nameListBox.Items.Add(Mid(streamstring, 1, y)) scoreListbox.Items.Add(Mid(streamstring, y + 1, streamstring.Length)) End If y += 1 End While x += 1 End While
Last edited by a moderator: