Results 1 to 7 of 7

Thread: Including a File

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Location
    North Carolina
    Posts
    4

    Including a File

    Alright. I need to include a text file that I host on a website, into my program. I'm not sure if you can do this, but I need to. What specific code, or object (with code) should I use, to do this?

    Version Used: Microsoft Visual Basic 2008 Express Edition

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Including a File

    There is no code. Just add the file to your project in the Solution Explorer. In a WinForms app you'd have to set the file's Copy To Output Directory property to True. I'm not sure if it's the same for a web site but you should check the file's properties to see what's there.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Location
    North Carolina
    Posts
    4

    Re: Including a File

    What I'm wanting to do though, is the user download my program. Then, I be able to update the program, from the TXT file (It contains the information that the program displays). So the user does not have to redownload the program twice a week.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Including a File

    So what are you actually asking for? Do you want your program to download the file from your web site? If so then it's just My.Computer.Network.DownloadFile.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Location
    North Carolina
    Posts
    4

    Re: Including a File

    Sorta! I want it to grab a text file. Get the contents of the file (The text file is online). Then display the contents of the file, on my form.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Including a File

    If you want the contents of a text file but you don't want to save the file itself then you'd create a WebClient object and call its DownloadString method.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2010
    Location
    North Carolina
    Posts
    4

    Re: Including a File

    I'm not sure how to do this. I'm just now learning. Started out as a class, and now I'm wanting to take it further.

    EDIT: I figured it out! Thanks so much!
    Last edited by TommyEvans; Feb 18th, 2010 at 08:09 PM.

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