Results 1 to 3 of 3

Thread: Read lines of a text file?

  1. #1

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    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:
    1. Dim StringArrayOfTextLines() As String = File.ReadAllLines("file\wordlist.txt") 'load wordlist
    2.         Dim MaxAmount As Integer = StringArrayOfTextLines.GetUpperBound(0) + 1

    How can I do this in a Windows Mobile Application?

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    PowerPoster formlesstree4's Avatar
    Join Date
    Jun 2008
    Posts
    3,250

    Re: Read lines of a text file?

    Thank you very much petevick!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width