Results 1 to 4 of 4

Thread: [RESOLVED] [2005] Read text file from web site

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Resolved [RESOLVED] [2005] Read text file from web site

    Hi,

    I am using VB2005

    Can I read from my program a text file from a web site without to download the text file?

    Thanks in advance

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

    Re: [2005] Read text file from web site

    You have to download the information the text file contains, but you don't have to save the file locally. The WebClient.DownloadString method will download the the contents of the file directly into a String object.
    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
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    Re: [2005] Read text file from web site

    Hi,

    Code:
            Dim url As String = "http://website/test.txt"
            Dim sampleClient As New Net.WebClient()
            Dim content As String = sampleClient.DownloadString(url)
            TextBox1.Text = content
    Thanks for your Reply

  4. #4
    Member
    Join Date
    Mar 2005
    Posts
    43

    [2003] Read text file from web site

    How do i use it in VB2003
    Dim content As String = sampleClient.DownloadString(url)
    gives me a error

    john
    Last edited by johna007; Jun 15th, 2007 at 08:55 AM.

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