Link to home
Start Free TrialLog in
Avatar of JPERKS1985
JPERKS1985

asked on

Using the MSHTML collection with a string containing HTML

I'm request html using the following method,


      Dim sResult As String
                        Dim oHttp As HttpWebRequest
                        Dim objResponse As WebResponse
                        Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(EventUrl)




                        objRequest.Method = "GET"
                        objRequest.Timeout = 120000 ' 20 sec.
                        objResponse = objRequest.GetResponse

                        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(objResponse.GetResponseStream(), System.Text.Encoding.UTF7)

                        sResult = sr.ReadToEnd()
                        ' Close and clean up the StreamReader
                        sr.Close()

debug.write(sresult.tostring)

                        Dim DOCHTML As String
                        doc = DirectCast(sResult, mshtml.HTMLDocument)
                        dochtml = doc.documentElement.innerHTML()
                        Debug.Write(DOCHTML)


This doesn't seem to convert the html string so that it can be used with the mshtml collection. If I choose to display the html after it finishes with debug.write(sresult.tostring) it will output to the debug window. But when I try to output it with  Debug.Write(DOCHTML) it won't work. 500 points because I'm trying to finish the development of this application within the next few weeks. thanks guys.


ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JPERKS1985
JPERKS1985

ASKER

Hmm problem is I need to parse out different controls , heres part of the code I'm using









        For Each elm In all
            strName = elm.getAttribute("NAME")
            strId = elm.id
            strvalue = elm.innerText
            strType = elm.getAttribute("type")


Anyway to convert my string to wokr with that?
nevermind I got it working thanks.
Now is there a way to use this source to pass cookies? Also is there a way for proxy support? Thats why I was using httprequest
Better yet, how do I extract the cookies and route the request for the page through a proxy?