how to get html source from inet control

How to get html source from inet control

        i am trying to access html source code from vb inet control.
        but i am not getting full html source code of the give url
        for  eg:     htsource = Inet1.OpenURL(url, icString)
        whenever i am executing this line of code i got the html source
        plz help me to solve this problem
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you tried downloading the latest service patch from Microsoft? SP4 fixed it.
Stephen MandersonSoftware EngineerCommented:
Hi there you could try this.

Dim strURL As String
Dim strHTML As String

strURL = ""

With Inet1
.AccessType = icUseDefault
strHTML = .OpenURL(strURL)
End With

' Translate linefeeds into vbCrLFs if necessary.
If InStr(strHTML, Chr(10)) Then
strHTML = Replace$(strHTML, Chr(10), vbCrLf)
End If

txtHTML.Text = strHTML ' Fill a textbox with the source
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Stephen MandersonSoftware EngineerCommented:
or if you want to get the url from a text box change the strURL to

strURL = txturl.text

providing you have a text box named txturl
sobhamukthaAuthor Commented:

With Inet1
.AccessType = icUseDefault
strHTML = .OpenURL(strURL)
End With

i even tried the above code but i am not getting full html source
plz help to get the full html source from vb programme using inet control and also help how to put the multiple request from inet control(after getting the urls from source i save those urls in the  database)

thanking you
Stephen MandersonSoftware EngineerCommented:
Hi there, i have made an example and uploades it too, Hope this sorts your problems.
Stephen MandersonSoftware EngineerCommented:
Are you usuing a Rich Text Box ? I used that in my example and had no problems.
sobhamukthaAuthor Commented:
hi all

i got the solution.

Dim htsource As Variant

Private Sub Command1_Click()
With Inet1
htsource = ""
d.Execute Text1.Text, "GET"
Do While .StillExecuting
End With
Dim header As String
header = Inet1.GetHeader
MsgBox header
End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)
    Dim vtData As Variant       ' Data variable.
  '  Dim intFile As Integer      ' File number variable.
  '  intFile = FreeFile()        ' Get free file number.
    Select Case State
    ' ' Other cases not shown.
    Case icResponseCompleted
        ' Open a file to write to.
   '     Open "c:\test\avant.htm" For Binary Access _
    '        Write As #intFile

        ' Get the first chunk. NOTE: specify a byte
        ' array (icByteArray) to retrieve a binary file.
        vtData = Inet1.GetChunk(1024, icString)
        htsource = htsource & vtData
        Do While LenB(vtData) > 0
   '         Put #intFile, , vtData
            ' Get next chunk.
            vtData = Inet1.GetChunk(1024, icString)
            htsource = htsource & vtData
   '     Put #intFile, , vtData
   '    Close #intFile
   MsgBox "source" & htsource
    End Select
End Sub

PAQed with points refunded (250)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.