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
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
I was reading through the similar situation but the gentleman posting the
reply has submiited a attachment which is not be found anymore. I would
greatly apprecitate if the code is posted again.
Thanking you in advance,
Vibhu Bansal. 14 7449
Further to my post, I need to use IPersistStreamInit. I was reading this in
this forum itself. But unfortunately, the solution file posted as an
attachment is missing. I would request anybody who has a clue to it to get
asap.
Vibhu Bansal.
Further to my post, I need to use IPersistStreamInit. I was reading this in
this forum itself. But unfortunately, the solution file posted as an
attachment is missing. I would request anybody who has a clue to it to get
asap.
Vibhu Bansal.
Hi Charles,
It seems that the attachment is not getting posted. Please email the
attachment to me at vi****@hotmail.com if you can.
BTW, the gentleman is you itself and I was reading the post sometime of late
last year within this forum.
Vibhu.
"Charles Law" wrote: Hi Vibhu
I was reading through the similar situation but the gentleman posting the reply has submiited a attachment which is not be found anymore. I would greatly apprecitate if the code is posted again.
Do you know the Gentleman's name, and when it was posted?
GetWebPage = DocumentFactory.createDocumentFromUrl(strURL, vbNullString)
The problem is here because DocumentFactory has not been created yet.
Try the attached.
HTH
Charles
"Vibhu Bansal" <Vibhu Ba****@discussions.microsoft.com> wrote in message news:50**********************************@microsof t.com... 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 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
I was reading through the similar situation but the gentleman posting the reply has submiited a attachment which is not be found anymore. I would greatly apprecitate if the code is posted again.
Thanking you in advance,
Vibhu Bansal.
Hi Charles,
It seems that the attachment is not getting posted. Please email the
attachment to me at vi****@hotmail.com if you can.
BTW, the gentleman is you itself and I was reading the post sometime of late
last year within this forum.
Vibhu.
"Charles Law" wrote: Hi Vibhu
I was reading through the similar situation but the gentleman posting the reply has submiited a attachment which is not be found anymore. I would greatly apprecitate if the code is posted again.
Do you know the Gentleman's name, and when it was posted?
GetWebPage = DocumentFactory.createDocumentFromUrl(strURL, vbNullString)
The problem is here because DocumentFactory has not been created yet.
Try the attached.
HTH
Charles
"Vibhu Bansal" <Vibhu Ba****@discussions.microsoft.com> wrote in message news:50**********************************@microsof t.com... 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 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
I was reading through the similar situation but the gentleman posting the reply has submiited a attachment which is not be found anymore. I would greatly apprecitate if the code is posted again.
Thanking you in advance,
Vibhu Bansal.
I have just sent it so you should receive it shortly.
I am able to see the attachment on the newsgroup using MS Outlook Express as
my newsreader, so perhaps it is something at your end that is preventing you
from seeing it.
Charles
"Vibhu Bansal" <Vi*********@discussions.microsoft.com> wrote in message
news:72**********************************@microsof t.com... Hi Charles, It seems that the attachment is not getting posted. Please email the attachment to me at vi****@hotmail.com if you can. BTW, the gentleman is you itself and I was reading the post sometime of late last year within this forum. Vibhu.
"Charles Law" wrote:
Hi Vibhu
> I was reading through the similar situation but the gentleman posting > the > reply has submiited a attachment which is not be found anymore. I would > greatly apprecitate if the code is posted again.
Do you know the Gentleman's name, and when it was posted?
> GetWebPage = DocumentFactory.createDocumentFromUrl(strURL, > vbNullString)
The problem is here because DocumentFactory has not been created yet.
Try the attached.
HTH
Charles
"Vibhu Bansal" <Vibhu Ba****@discussions.microsoft.com> wrote in message news:50**********************************@microsof t.com... > 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 > 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 > > I was reading through the similar situation but the gentleman posting > the > reply has submiited a attachment which is not be found anymore. I would > greatly apprecitate if the code is posted again. > > Thanking you in advance, > > Vibhu Bansal. > >
I have just sent it so you should receive it shortly.
I am able to see the attachment on the newsgroup using MS Outlook Express as
my newsreader, so perhaps it is something at your end that is preventing you
from seeing it.
Charles
"Vibhu Bansal" <Vi*********@discussions.microsoft.com> wrote in message
news:72**********************************@microsof t.com... Hi Charles, It seems that the attachment is not getting posted. Please email the attachment to me at vi****@hotmail.com if you can. BTW, the gentleman is you itself and I was reading the post sometime of late last year within this forum. Vibhu.
"Charles Law" wrote:
Hi Vibhu
> I was reading through the similar situation but the gentleman posting > the > reply has submiited a attachment which is not be found anymore. I would > greatly apprecitate if the code is posted again.
Do you know the Gentleman's name, and when it was posted?
> GetWebPage = DocumentFactory.createDocumentFromUrl(strURL, > vbNullString)
The problem is here because DocumentFactory has not been created yet.
Try the attached.
HTH
Charles
"Vibhu Bansal" <Vibhu Ba****@discussions.microsoft.com> wrote in message news:50**********************************@microsof t.com... > 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 > 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 > > I was reading through the similar situation but the gentleman posting > the > reply has submiited a attachment which is not be found anymore. I would > greatly apprecitate if the code is posted again. > > Thanking you in advance, > > Vibhu Bansal. > >
Hi Charles,
Thanks for the info. Now I am getting stuck up in the next part i.e. using
this fuction, I need to get all elements by their tag names. So in VB6, I was
using the function getElementsbyTagname. But now as the page is being
retrieved in IHTMLDocument2 object, it does not support this function. Can
you provide me hints as to how I can use this functionality. I need to use
this function to look for images and store them on the local folder in the
harddisk.
Any help or references would be greatly beneficial.
Thanking You,
Vibhu.
Hi Charles,
Thanks for the info. Now I am getting stuck up in the next part i.e. using
this fuction, I need to get all elements by their tag names. So in VB6, I was
using the function getElementsbyTagname. But now as the page is being
retrieved in IHTMLDocument2 object, it does not support this function. Can
you provide me hints as to how I can use this functionality. I need to use
this function to look for images and store them on the local folder in the
harddisk.
Any help or references would be greatly beneficial.
Thanking You,
Vibhu.
Vibhu
getElementsByTagName is defined on the IHTMLDocument3 interface. Use
DirectCast to get this interface from the document object and you will then
be able to call the method as before.
HTH
Charles
"Vibhu Bansal" <Vi*********@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com... Hi Charles, Thanks for the info. Now I am getting stuck up in the next part i.e. using this fuction, I need to get all elements by their tag names. So in VB6, I was using the function getElementsbyTagname. But now as the page is being retrieved in IHTMLDocument2 object, it does not support this function. Can you provide me hints as to how I can use this functionality. I need to use this function to look for images and store them on the local folder in the harddisk. Any help or references would be greatly beneficial. Thanking You, Vibhu.
Vibhu
getElementsByTagName is defined on the IHTMLDocument3 interface. Use
DirectCast to get this interface from the document object and you will then
be able to call the method as before.
HTH
Charles
"Vibhu Bansal" <Vi*********@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com... Hi Charles, Thanks for the info. Now I am getting stuck up in the next part i.e. using this fuction, I need to get all elements by their tag names. So in VB6, I was using the function getElementsbyTagname. But now as the page is being retrieved in IHTMLDocument2 object, it does not support this function. Can you provide me hints as to how I can use this functionality. I need to use this function to look for images and store them on the local folder in the harddisk. Any help or references would be greatly beneficial. Thanking You, Vibhu.
Hi,
Instead of using getElementsbytagname, within IHTMDocument2 I stumbled on a
function of anchors. This is what the code looks like now...
Private Sub SearchUrl(ByVal strURL As String)
Dim objMSHTML As New mshtml.HTMLDocument
Dim objDocument As mshtml.IHTMLDocument2
Dim ips As IPersistStreamInit
Dim item As mshtml.IHTMLElement
ips = DirectCast(objMSHTML, IPersistStreamInit)
ips.InitNew()
objDocument = objMSHTML.createDocumentFromUrl(strURL, vbNullString)
Do Until objDocument.readyState = "complete"
Application.DoEvents()
Loop
For Each item In objDocument.anchors
Dim strUrl1 As mshtml.IHTMLAnchorElement
strUrl1 = item
MsgBox(strUrl1.href)
Next
End Sub
Now when this function is called, it does loop through objDocument.anchors
but shows a message box without any details. This is happening because it
seems that
objDocument's state is still not complete. I reached this inference because
the text in the text box is displayed after the message box has clicked on.
Any clues on why this is happening.
Vibhu.
Hi,
I finally got the problem working. Here is the solution...
We do need use IHTMLDocument3 in order to get the links with a page that has
been loaded.
Thanks Charles for the help you provided.
Private Sub SearchUrl(ByVal strURL As String)
Dim objMSHTML As New mshtml.HTMLDocument
Dim objDocument As mshtml.IHTMLDocument2
Dim ips As IPersistStreamInit
Dim HTMLTagCollection As mshtml.IHTMLElementCollection
Dim item As mshtml.IHTMLAnchorElement
ips = DirectCast(objMSHTML, IPersistStreamInit)
ips.InitNew()
objDocument = objMSHTML.createDocumentFromUrl(strURL, vbNullString)
Do Until objDocument.readyState = "complete"
Application.DoEvents()
Loop
TextBox1.Text = objDocument.body.innerHTML()
Dim ObjDocument3 As mshtml.IHTMLDocument3
ObjDocument3 = DirectCast(objDocument, mshtml.IHTMLDocument3)
HTMLTagCollection = ObjDocument3.getElementsByTagName("A")
For Each item In HTMLTagCollection
MsgBox(item.href)
Next
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: BKM |
last post by:
I've been using the following 2 ways to make sure my WebBrowser is finished
loading a page before continuing with the next code.
do:doevents:loop while WebBrowser.Busy
do:doevents:loop until...
|
by: travisGatesMcGee |
last post by:
For days and days, I have been trying to see a URL's parsing in a DOM tree
(links collection, images and other DHTML elements) in Visual Basic.........
Total Disaster!!!!!!!!!! Way too many...
|
by: Thomas Seidel |
last post by:
Hi NG,
I would like to write a specific library that gets it data from a specific
webpage.
Because not all web sites are XHTML I guess I have to use the old com
library
MSHTML. Beacause it...
|
by: DotNetShadow |
last post by:
Hi Guys,
I have been reading heaps of information in regards to MSHTML object
being used in .NET applications, windows and UI-less. I have read the
walkall samples and tried various techniques...
|
by: DotNetShadow |
last post by:
Hi Guys,
I have been reading heaps of information in regards to MSHTML object
being used in .NET applications, windows and UI-less. I have read the
walkall samples and tried various techniques...
| |
by: ddd |
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:
Dim doc As...
|
by: Bob Hollness |
last post by:
Hi all (me again. I do try to answer the posts I can instead of just
asking!!!)
Any ideas how I could load a webpage into a control that was about the size
of a stamp? I tried a few things but...
|
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...
|
by: Atara |
last post by:
Our application was build with VS 2003.
I have tried to run it on a computer with .Net 2.0 (but without .Net 1.1
, as it should be used)
and I got the following error -
...
|
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,...
|
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...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |