I’m quite new to vb and doing simple basics, I have managed to access and read a specific file line by line. If I wanted to split information by a comma or space and then sort alphabetically or numerically, how would I go about this procedure? Would I create a loop within the reading loop to parse the information? A simple to follow example would really help…Thanks!
Dim file As String = "C:\Users\test.txt"
Dim Line As String
If System.IO.File.Exists(file) = True Then
Dim objReader As New System.IO.StreamReader(file)
Do While objReader.Peek() <> -1
Line = Line & objReader.ReadLine() & vbNewLine
Loop
Next
Label1.Text = Line
objReader.Close()
Else
MsgBox("File Does Not Exist")
End If
It depends what you want do do with the text you split really.
The Split() function will return you an array of string with the results of your split, from there it really depends on the data.
Here is an example of using split http://www.dotnetperls.com/split-vbnet
Since you mentioned you want to sort the data alphabetically you may wish to look at http://www.codepedia.com/1/VBNET_ArraySort or look into using LINQ.
It is quite acceptable to nest a loop within your main loop if you want to do something more complex with the data.