473,387 Members | 1,583 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.

Problem with Document from WebBrowser control

I am at my wits' end.

I have the following code:

WebBrowser1.Navigate ("c:\path\page.htm")
Text1.Text = WebBrowser1.Document.Links.length

Where the page.htm has the following HTML:

<html>
<head><title></title></head>
<body>
<h1>Test</h1>
<a href="somepage.htm">Link</a><br>
<a href="anotherpage.htm">Second Link</a><br>
<a href="andonemore.htm">Third Link</a><br>
Test
</body>
</html>

Page loads into browser control fine, but the value that appears in
the TextBox control is "0". This is the same value I get when I query
any of the collections in the Document object. I cannot figure out
what magic I need to perform to be able to analyze the document object
that is current loaded in the WebBrowser control. Any help you guys
could give me would be greatly appreciated.

Further info:

VB6
WinXP

TIA

Mark
Jul 17 '05 #1
1 5916
ma******@shore.net (Mark) wrote in message news:<cf*************************@posting.google.c om>...
I am at my wits' end.

I have the following code:

WebBrowser1.Navigate ("c:\path\page.htm")
Text1.Text = WebBrowser1.Document.Links.length

Where the page.htm has the following HTML:

<html>
<head><title></title></head>
<body>
<h1>Test</h1>
<a href="somepage.htm">Link</a><br>
<a href="anotherpage.htm">Second Link</a><br>
<a href="andonemore.htm">Third Link</a><br>
Test
</body>
</html>

Page loads into browser control fine, but the value that appears in
the TextBox control is "0". This is the same value I get when I query
any of the collections in the Document object. I cannot figure out
what magic I need to perform to be able to analyze the document object
that is current loaded in the WebBrowser control. Any help you guys
could give me would be greatly appreciated.

Further info:

VB6
WinXP

TIA

Mark


AFAIK, WebBrowser.Navigate works asynchronously, i.e. page may still
be loading/parsing when you query HTML DOM for links.length.

Try to delay queries until page is completely loaded. Check out
ReadyState property and NavigateComplete event.

Maybe there is a way to turn off asynchronous loading
(like in DOMDocument.async = False), but not to my knowledge.

- kv
Jul 17 '05 #2

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

Similar topics

5
by: Charles Law | last post by:
Sorry for the cross post, but I'm not sure who is best placed to answer this one. This is the most bizarre behaviour of MSHTML and streams. I have a WebBrowser control that contains nothing...
1
by: mrbog | last post by:
Using the WebBrowser control, can someone load one of my web pages and see the HTML that has been generated by document.write() javascript? For example, if I have a page that has obfuscated...
7
by: Mike | last post by:
Hi! I posted this question in browser_ctl group as well but got no results. I have a form with embedded WebBrowser. Upon clicking on a link in the embedded webbrowser that calls JavaScript's...
1
by: JerryShea | last post by:
Hi, I am opening a word document (RTF) in a webbrowser control and automating it. Most automation features seem to work but when I execute: wordApp.ActiveDocument.PrintPreview() I get an...
7
by: ljlevend2 | last post by:
Is there any way to modify a document before it is displayed by a System.Windows.Forms.WebBrowser control? The Navigating event occurs before the document is loaded, but it does not expose the...
2
by: Dean Richardson | last post by:
Hello, I am currently building a windows application in VB.NET. At the moment I have a word document saved locally which I open with the WebBrowser control. I cannot seem to save the changes...
0
by: Dean Richardson | last post by:
Hello, I am currently building a windows application in VB.NET. At the moment I have a word document saved locally which I open with the WebBrowser control. I cannot seem to save the...
1
by: David Veeneman | last post by:
I'm writing an application that will manage a database of documents typed into the application by the user. Some documents will contain links to other documents. If the user clicks on a link, the...
1
by: zdp | last post by:
Hi, all, My project is based on wxPython, and I need an IE control (i.e. WebBrowser ActiveX control). Although the wxPython implements a wrapped version (wx.lib.iewin.IEHtmlWindow), but it...
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: 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: 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
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
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 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.