createDocumentFromUrl usage in VB.NET

V

Vibhu

Hello All,
I need to use mshtml.HTMLDocument.createDocumentFromUrl in VB.NET to
load a webpage. The code looks like this

Imports mshtml
Public DocumentFactory As HTMLDocument

would be very grateful if you could let me know how to solve this
problem in VB.NET. I am getting the error "Object reference not set to
an instance of object" I am listing the code below that I am using.

Imports mshtml
Public DocumentFactory As HTMLDocument

Public Function GetWebPage(ByVal strURL As String) As HTMLDocument
Try
GetWebPage = DocumentFactory.createDocumentFromUrl(strURL,
vbNullString)
StatusBar1.Panels(1).Text = strURL
Do Until GetWebPage.readyState = "complete"
Application.DoEvents()
Loop
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

On further reading I found that as HTMLDocument is just an interface so
I need to cast it as IPersistStreamInit. Therefater I have got stuck as
I donot know how this needs to be done. Some of the sites I went
through, gave this implementation

Imports System.Runtime.InteropServices

and in the Function GetWebPage(...)... add

Dim ips As IPersistStreamInit

But .NET does not recognize IPersistStreamInit

What to do???

I will be grateful if somebody gives a solution to this problem.
Any help would be greatly appreciated.
 
C

Charles Law

Hi Vibhu

I think we get the picture :)

Have a look at the answer to your earlier post.

Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top