PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
createDocumentFromUrl usage in VB.NET
Forums
Newsgroups
Microsoft DotNet
Microsoft VB .NET
createDocumentFromUrl usage in VB.NET
![]() |
createDocumentFromUrl usage in VB.NET |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

