473,587 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

createDocumentF romUrl usage in VB.NET

Hello All,
I need to use mshtml.HTMLDocu ment.createDocu mentFromUrl 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(ByVa l strURL As String) As HTMLDocument
Try
GetWebPage = DocumentFactory .createDocument FromUrl(strURL,
vbNullString)
StatusBar1.Pane ls(1).Text = strURL
Do Until GetWebPage.read yState = "complete"
Application.DoE vents()
Loop
Catch ex As Exception
MsgBox(ex.Messa ge)
End Try
End Function

On further reading I found that as HTMLDocument is just an interface so
I need to cast it as IPersistStreamI nit. 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 IPersistStreamI nit

But .NET does not recognize IPersistStreamI nit

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 6501
Hi Vibhu

I think we get the picture :-)

Have a look at the answer to your earlier post.

Charles
"Vibhu" <vi*********@gm ail.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Hello All,
I need to use mshtml.HTMLDocu ment.createDocu mentFromUrl 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(ByVa l strURL As String) As HTMLDocument
Try
GetWebPage = DocumentFactory .createDocument FromUrl(strURL,
vbNullString)
StatusBar1.Pane ls(1).Text = strURL
Do Until GetWebPage.read yState = "complete"
Application.DoE vents()
Loop
Catch ex As Exception
MsgBox(ex.Messa ge)
End Try
End Function

On further reading I found that as HTMLDocument is just an interface so
I need to cast it as IPersistStreamI nit. 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 IPersistStreamI nit

But .NET does not recognize IPersistStreamI nit

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*********@gm ail.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Hello All,
I need to use mshtml.HTMLDocu ment.createDocu mentFromUrl 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(ByVa l strURL As String) As HTMLDocument
Try
GetWebPage = DocumentFactory .createDocument FromUrl(strURL,
vbNullString)
StatusBar1.Pane ls(1).Text = strURL
Do Until GetWebPage.read yState = "complete"
Application.DoE vents()
Loop
Catch ex As Exception
MsgBox(ex.Messa ge)
End Try
End Function

On further reading I found that as HTMLDocument is just an interface so
I need to cast it as IPersistStreamI nit. 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 IPersistStreamI nit

But .NET does not recognize IPersistStreamI nit

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
460
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 the app I load some things into memory for global use of the app but I'll use only 2 starting forms to explain the situation) situation 1 start app with form 1 (72mb memory usage), show form 2 and hide form 1 (89 mb memory usage
0
1562
by: gqtang | last post by:
How to use IHTMLDocument2.createDocumentFromUrl method
1
3723
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 = MSHTMLobj.createDocumentFromUrl(http://www.microsoft.com, ""); I get this error: The server threw an exception.
0
1683
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: HTMLDocument hd = new HTMLDocument(); IHTMLDocument2 ihd;
1
4539
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 some unnecessary steps but was supposed to work, but for me it throws an "unknown error" exception. Any help would be appreciated. Dim doc1 As mshtml.IHTMLDocument2 ' HTMLDocument() Dim docU As New mshtml.HTMLDocument() Dim doc2a As...
14
7468
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 am using Imports mshtml Public DocumentFactory As HTMLDocument Public Function GetWebPage(ByVal strURL As String) As HTMLDocument
0
345
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 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.
0
1229
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 the application I am attempting. I receive the following IE message when making this call: This page has an unspecified potential security flaw. Would you like to
0
3353
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 partially working, because I am able to access the HTMLDocument.title. However, when I try to read the output of the getElementsByTagName() member, I am getting length = 0 inside the IHTMLElementCollection object receiving the output. When I...
0
7924
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7854
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.