473,778 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Document from WebBrowser control

I am at my wits' end.

I have the following code:

WebBrowser1.Nav igate ("c:\path\page. htm")
Text1.Text = WebBrowser1.Doc ument.Links.len gth

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="anotherpa ge.htm">Second Link</a><br>
<a href="andonemor e.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 5928
ma******@shore. net (Mark) wrote in message news:<cf******* *************** ***@posting.goo gle.com>...
I am at my wits' end.

I have the following code:

WebBrowser1.Nav igate ("c:\path\page. htm")
Text1.Text = WebBrowser1.Doc ument.Links.len gth

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="anotherpa ge.htm">Second Link</a><br>
<a href="andonemor e.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.Navi gate 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 NavigateComplet e event.

Maybe there is a way to turn off asynchronous loading
(like in DOMDocument.asy nc = 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
2772
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 but some default HTML. I want to copy the document and modify it before saving it to disk. So, I clone the document like this:
1
1818
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 javascript that does a document.write(), I'm not concerned if someone can view that javascript (because it won't be easy to un obfuscate the javascript). But, using the webbrowser control could someone see the HTML that the document.write generated?
7
6521
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 window.open() call where I pass different width, height, top, left and other parameters, I open a new form of the same type as the original. I noticed that the webbrowser in the newly opened form is shifted to the right and bottom leaving gray areas...
1
2243
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 exception thrown: "Requested view is not available." Can anyone help me to get this document to preview?
7
3773
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 document object. On the other hand, the DocumentCompleted event exposes the document object, but it occurs after the WebBrowser has loaded the document. What I want is something like a DocumentCompleting event (which does not exist) that would...
2
3229
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 made to the document. I have a button on the Windows form which is used for saving the document. At the moment the code behind the button is as follows:
0
1182
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 made to the document.
1
5814
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 application will get the linked document from the database and display it. The .NET 2.0 WebBrowser control looks like a good candidate to display the documents (document entry will by done by a form with text boxes). Here are my questions: ...
1
2837
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 doesn't meet all my demands, because I need to custom many behaviors of the control. So I thought I should use it through ActiveXWrapper directly. So I use makepy to make the typelib of "Microsoft Internet Controls" and "Microsoft HTML Object...
0
9629
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
10298
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...
0
9923
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7475
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
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5370
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
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
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 we have to send another system
3
2865
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.