473,387 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.

Nov 21 '05 #1
2 6484
Hi Vibhu

I think we get the picture :-)

Have a look at the answer to your earlier post.

Charles
"Vibhu" <vi*********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.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.

Nov 21 '05 #2
Hi Vibhu

I think we get the picture :-)

Have a look at the answer to your earlier post.

Charles
"Vibhu" <vi*********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.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.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting...
0
by: gqtang | last post by:
How to use IHTMLDocument2.createDocumentFromUrl method
1
by: Brett | last post by:
I'm having problems trying to get HTML content from a website. object WebpageContent; mshtml.HTMLDocument MSHTMLobj = new mshtml.HTMLDocument(); WebpageContent =...
0
by: Tunga Torgal | last post by:
I am trying to use MSHTML without the webbrowser and I am having a few problems. Right now all I am trying to do is load an URL(html page) and access its innerhtml. What I have is: ...
1
by: Pat Mac | last post by:
Does anyone have a working example of the HTMLDocument.createDocumentFromUrl function?? The few examples I found on the net don't seem to work. Here's a piece of code that seems to go through...
14
by: Vibhu Bansal | last post by:
Hello, I am having certain problems in trying to use the function createDocumentFromUrl in VB.NET but get this error.."Object reference not set to an instance of object". Here is the code that I...
0
by: Vibhu | last post by:
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...
0
by: Jack Clift | last post by:
Dear Sirs, Sorry, have reposted from another section as have not received any response... I am using createDocumentFromUrl to obtain data from the web, which is called several times (>100) for...
0
by: k1ngdrew | last post by:
I am trying to use mshtml to parse a web page without using IE. I create the HTMLDocument object, and then assign to it the output value from createDocumentFromUrl(). I know that this is at least...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.