Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Little problem with Inet

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
DImirC
Asked:
DImirC
1 Solution
 
Toad224Commented:
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
 
DImirCAuthor Commented:
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
 
Toad224Commented:
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
 
DanRollinsCommented:
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
 
NetminderCommented:
Per recommendation, force-accepted.

Netminder
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now