I have this code from VB6 that works fineI then run it through the VS.Net VB upgrade tool and get thisVB Code:
Dim objLink As HTMLLinkElement Dim objMSHTML As New MSHTML.HTMLDocument Dim objDoc As MSHTML.HTMLDocument Set objDoc = objMSHTML.createDocumentFromUrl("http://www.yahoo.com", vbNullString) While objDoc.readyState <> "complete" DoEvents Wend 'get all Links For Each objLink In objDoc.links Debug.Print objLink NextI get an error on the lineVB Code:
Dim objLink As mshtml.HTMLLinkElement Dim objMSHTML As New mshtml.HTMLDocument Dim objDoc As mshtml.HTMLDocument objDoc = objMSHTML.createDocumentFromUrl("http://www.yahoo.com", vbNullString) While objDoc.readyState <> "complete" System.Windows.Forms.Application.DoEvents() End While 'get all Links For Each objLink In objDoc.links System.Diagnostics.Debug.WriteLine(objLink) Next objLinkSaying "An unhandled exception of type 'System.NullReferenceException' occured in mscorlib.dll"VB Code:
objDoc = objMSHTML.createDocumentFromUrl("http://www.yahoo.com", vbNullString)
"Additional Information: Object reference not set to an instance of an object"




I drink to make other people more interesting!
Reply With Quote