Results 1 to 4 of 4

Thread: [RESOLVED] What is the best way to read from a text file?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2015
    Location
    SoCal.
    Posts
    16

    Resolved [RESOLVED] What is the best way to read from a text file?

    If I make a .txt on my USB I usually have problems later on when it's time to publish the project onto a DVD. Is adding / making them with resources the best way?

  2. #2
    Fanatic Member Toph's Avatar
    Join Date
    Oct 2014
    Posts
    655

    Re: What is the best way to read from a text file?

    IO.File.ReadAllLines/ReadAllText
    If you find my contributions helpful then rate them.

  3. #3
    PowerPoster Evil_Giraffe's Avatar
    Join Date
    Aug 2002
    Location
    Suffolk, UK
    Posts
    2,555

    Re: What is the best way to read from a text file?

    If you add the text file to your project, then in its properties make sure the Build Action is set to "Content" (if you add a New Item to the project and select Text File this should be the default I believe - if you have already created it and select Add Existing Item then it might not be) and that the Copy to Output Directory is set to "Copy Always" or "Copy if newer" then part of building your application will be ensuring that the text file is in the output folder.

    If you want the text file deployed elsewhere, such as the User's ApplicationData folder, that's a different matter.

  4. #4
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,757

    Re: What is the best way to read from a text file?

    You could also add the file as a resource, then you could read it using this...

    Code:
    Dim fileContent As String = My.Resources.myFileRourceName
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

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