Solved

Little problem with Inet

Posted on 2002-06-23
5
170 Views
Last Modified: 2010-05-02
I have to download the HTML of a page that is very big so I want that while its being downloded, to put the HTML in a Textbox. This is how I'm trying that:


If State = 12 Or State = 8 Then

    bloque = Inet1.GetChunk(1024, icString)
    DoEvents
    Do While Not bDone
       des = des & bloque
       DoEvents
       ' Obtiene el bloque siguiente.
       bloque = Inet1.GetChunk(1024, icString)
       If Len(des) = 0 Then
          bDone = True
       End If
    Loop
end if

But I get some errors. I dont use just the state 12 because it will waits until the whole page is downloaded...

What can I do?
0
Comment
Question by:DImirC
5 Comments
 
LVL 1

Accepted Solution

by:
Toad224 earned 200 total points
Comment Utility
Why don't you try this...  It seems to work well for me...

Private Sub Command1_Click()
Inet1.Execute "http://www.microsoft.com/"
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
 Select Case State
        Case icResponseCompleted
            Do
                DoEvents
                strBuffer = Inet1.GetChunk(1024)
                Text1.Text = Text1.Text & strBuffer
            Loop Until Len(strBuffer) = 0
End Select
End Sub


I hope this helps.  Good luck!
0
 

Author Comment

by:DImirC
Comment Utility
But the problem is that the page is very very big, about 5000 lines, so I dont want to wait until it is complete... I want the HTML to be shown inmediatly after its downloaded
0
 
LVL 1

Expert Comment

by:Toad224
Comment Utility
When I use the code I put above, it shows the downloaded data as it is downloaded instead of waiting until it's complete.  Do    strBuffer = Inet1.GetChunk(10)    instead of the 1024 one to see the data appear faster.
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Hi DImirC,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept Toad224's comment(s) as an answer.
    *** I don't think the answer is 100% correct since the code needs to handle icResponseReceived, but it does show that the text must be appended to the output as it comes in.

DImirC, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 5

Expert Comment

by:Netminder
Comment Utility
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now