Results 1 to 8 of 8

Thread: downloading a web page into a text box.

  1. #1

    Thread Starter
    New Member mwpickle's Avatar
    Join Date
    Nov 2005
    Location
    Australia
    Posts
    15

    downloading a web page into a text box.

    I've only just started playing around with the internet controls and stuff so I'm pretty much a n00b at this but this is what i want to do. I want to download a website into a text box then filter out all some of it so i'm left with what i want. I'm alright when comes to the filtering but when I download a page it only downloads half of it. My code for downloading a page is:

    VB Code:
    1. Text2.Text = Inet1.OpenURL("http://www.4q.cc/vin/")

    Please help, Thanks in Advanded.

  2. #2
    Fanatic Member mateo107's Avatar
    Join Date
    Jan 2005
    Posts
    547

    Re: downloading a web page into a text box.

    Perhaps you may want to use a Rich Text Box , instead of a regular text box. There are size limits on the standard textbox and I wonder if perhaps that might be causing a problem...

    I'm also a relative N00B to VB and especially iNet controls.. so this may or may not help at all


    -Matthew-

  3. #3
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: downloading a web page into a text box.

    I tried your code and had no trouble.
    Length of text put into the textbox was 6958 (7311 if not multiline) characters.

  4. #4

    Thread Starter
    New Member mwpickle's Avatar
    Join Date
    Nov 2005
    Location
    Australia
    Posts
    15

    Re: downloading a web page into a text box.

    Thank you for your quick response , I tried the rich text box but still I have the same problem. I think it might be timing out or only showing the amount it has downloaded within a time. this is how far mine got. But then I relised that is stoping always after the ";creative=932" bit. Any ideas?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>Random Vin Diesel Fact</title>
    <link rel="stylesheet" type="text/css" href="style.css"/>
    <link rel="alternate" title="Random Vin Diesel Fact RSS" href="http://www.4q.cc/vin/rss.php" type="application/rss+xml"/>
    <meta name="keywords" content="vin diesel, comedy, humor, acting, xxx, cell phones, news, university, movies, dvd, posters, travel, sex, shopping, college, school, free" />
    <meta name="description" content="Displays a random 'fact' about Vin Diesel" />
    </head>
    <body>
    <!-- <p class="bottom"><a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&amp;camp=1789&amp;tag=randomvindies-20&amp;creative=932

  5. #5
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    Chesterfield, Mi
    Posts
    259

    Re: downloading a web page into a text box.

    Why not use the URLDownloadToFile api ?

    VB Code:
    1. Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
    2.  
    3. Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    4.     Dim lngRetVal As Long
    5.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    6.     If lngRetVal = 0 Then DownloadFile = True
    7. End Function

  6. #6

    Thread Starter
    New Member mwpickle's Avatar
    Join Date
    Nov 2005
    Location
    Australia
    Posts
    15

    Re: downloading a web page into a text box.

    Thanks for the reply, how do I use this to put the code into a textbox or varible. Thanks.

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: downloading a web page into a text box.

    Try this:
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4.   Dim x As Integer, st As String
    5.   Dim ff As Integer
    6.   ff = FreeFile
    7.   Open App.Path & "\to do.txt" For Input As #ff ' Supply path and filename
    8.     Text1.text = Input(LOF(ff), ff)
    9.   Close #ff
    10. End Sub

  8. #8
    New Member
    Join Date
    Feb 2006
    Posts
    5

    Re: downloading a web page into a text box.

    What exactly are you looking for in the source of the website? You might be able to parse the HTML and find it there? Parsing gives you tags such as IMG and Links If you need more then that then parsing isn't the road to go.

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