473,382 Members | 1,225 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,382 software developers and data experts.

getting createDocumentFromUrl() to work

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 mshtml.IHTMLDocument2 'mshtml.HTMLDocument()
Dim doc2 As mshtml.IHTMLDocument2

Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnStart.Click

Try
doc1 = docU
doc2a = docU
doc2a.write("<html></html>")
doc2a.close()
'This is the line that generates the exception.
doc2 = doc1.createDocumentFromUrl("http://www.yahoo.com", "null")
While doc2.readyState <> "complete"
Application.DoEvents()
End While
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub
Nov 20 '05 #1
1 4516
Cor
Hi Pat,

I never used it in that way, but when I see that Yahoo link you use, I think
that you are not on the right route.

If it would work, I think that the HTMLDocument.createDocumentFromUrl would
needed a full path. But I have no expirience with that and maybe I am wrong,
but because of the nature of the HTMLDocument I think that it is than very
close to it.

The HTMLDocument is always one document. So if a page exist of more
documents (frames) only one "HTML" document can exist in a HTMLDocument,
that is includes by instance the on page javascript but not things as
pictures and so.

You ask ask for "http//www.yahoo.com" that is the site not a document.

When you want to do like you do above, I would take a look for the
"webbrowser" class.

Maybe not the answer you wanted, but because there was no other, I think
when it is wrong, I will not be far beside it.

I hope this helps a little bit?

Cor,
Nov 20 '05 #2

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

Similar topics

2
by: Chris | last post by:
I am running an ASP script which I require to get the source html from some URL so I can pick out bits of this and include the data in my webpage. So it should have a function something like this:...
0
by: gqtang | last post by:
How to use IHTMLDocument2.createDocumentFromUrl method
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...
2
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...
4
by: Hiten | last post by:
Hi, I am trying to find a way to get and change file summary information. I tried using FileInfo class, but it doesn't give me information such as "Author,Title,Rating" etc. Is there a way to...
2
by: ImOk | last post by:
WHen I run this under Windows I get the Count of drives but then I get an error message on the Reset() when I try to enumerate. Does this work for anyone? $fs = new...
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: RandyH | last post by:
Hello, I can do do this in the page load when NOT using a formview, but how can I do this with a formview control??? Me.btnReturn.Attributes.Add("onclick", "history.back();return false")
4
by: smdreger | last post by:
I have several email fields in my Customer Contact database. The fields are set up as hyperlinks. When I enter an email address for the customers they appear as a hyperlink. When I click on them...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.