Read lines of a text file?
I need to be able to open a text file, and read all the lines and store them into an array.
I did this in a Windows Application like so:
vb.net Code:
Dim StringArrayOfTextLines() As String = File.ReadAllLines("file\wordlist.txt") 'load wordlist
Dim MaxAmount As Integer = StringArrayOfTextLines.GetUpperBound(0) + 1
How can I do this in a Windows Mobile Application?
Re: Read lines of a text file?
Hi,
you could try something like...
Code:
Dim sr As New System.IO.StreamReader("\My Documents\myfile.txt")
Dim strData As String = sr.ReadToEnd
Dim strRecs() As String = strData.Split(vbCrLf)
Or read it in one line at a time, and add it to an array
Re: Read lines of a text file?
Thank you very much petevick!