Results 1 to 8 of 8

Thread: [Resolved] Reading through a File

Threaded View

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    [Resolved] Reading through a File

    This is my first jump into VB.NET, and I'm trying to make a simple To Do list. I want to open a text file, read each line, and add the data to a ListView. This is the code I have:

    VB Code:
    1. Dim fs As New IO.FileStream("todo.txt", IO.FileMode.Open)
    2. Dim sr As New IO.StreamReader(fs)
    3.  
    4. Do Until sr.Peek = -1
    5.     MsgBox(sr.ReadLine())
    6. Loop
    7.  
    8. fs.Close()

    The file contains three lines, but no message box is ever shown. What am I doing wrong?
    Last edited by The Hobo; Oct 20th, 2003 at 09:51 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

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