Results 1 to 2 of 2

Thread: Loading listbox with contents of text file[RESOLVED]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Posts
    162

    Exclamation Loading listbox with contents of text file[RESOLVED]

    I'm completely new to .net and kinda trying to fool around with it. i want to load a listbox with the contents of a text file and the code in VB6 would be something like:
    VB Code:
    1. dim strTemp as string
    2. Open App.Path + "\file.txt" For Input as #1
    3. Do While Not EOF(1)
    4. Line Input #1, strTemp
    5. List1.AddItem strTemp
    6. Wend
    Just wondering what the .Net equivalent would be.

    Plus, everytime I use the Application.StartUpPath + "\file.txt" it always says it cannot find the file.
    Any help would be greatly appreciated.
    Last edited by SuperChris9; Feb 9th, 2004 at 02:08 PM.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    I believe this question has been asked a few times previously. You should try a search first to get a faster answer: here try some of these: http://www.vbforums.com/search.php?s...der=descending

    Also the startup path is generally the application folder where the exe is, which in development is the bin folder. Is that file in your bin folder?

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