Results 1 to 4 of 4

Thread: [RESOLVED] Web Access - Retrieving Source Code

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    116

    Resolved [RESOLVED] Web Access - Retrieving Source Code

    Hi,

    How do you retrieve source code for a webpage? In VB6, I could use the Internet Transfer Control and simply type:
    Text1.Text = Inet1.OpenURL("http://www.google.co.uk/")

    What's the equivalent in VB2005?

  2. #2
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: Web Access - Retrieving Source Code

    Very easy using the WebClient Class
    VB Code:
    1. Dim client As New WebClient()
    2.  
    3.         TextBox1.Text = client.DownloadString("http://www.vbforums.com")
    4.  
    5.         client.Dispose()
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    116

    Re: Web Access - Retrieving Source Code

    Hi,

    I didn't have a reference to the Net namespace, originally, so the first line had to be:
    Dim client As New Net.WebClient()

    Thanks.

  4. #4
    Fanatic Member
    Join Date
    May 2005
    Posts
    898

    Re: [RESOLVED] Web Access - Retrieving Source Code

    Imports System.Net at the top. forgot to mention...
    "so just keep in mind that fantasy is not the same as realtiy and make sure u remember that wii sports may be fun but u cant count on it as exercise ok cool bye" - HungarianHuman

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