PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET createDocumentFromUrl usage in VB.NET

Reply

createDocumentFromUrl usage in VB.NET

 
Thread Tools Rate Thread
Old 27-01-2005, 10:37 AM   #1
Vibhu
Guest
 
Posts: n/a
Default createDocumentFromUrl usage in VB.NET


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.

  Reply With Quote
Old 27-01-2005, 10:43 AM   #2
Charles Law
Guest
 
Posts: n/a
Default Re: createDocumentFromUrl usage in VB.NET

Hi Vibhu

I think we get the picture :-)

Have a look at the answer to your earlier post.

Charles


"Vibhu" <vibhubansal@gmail.com> wrote in message
news:1106822236.195136.23820@z14g2000cwz.googlegroups.com...
> 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.
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off