473,397 Members | 2,099 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,397 software developers and data experts.

WebBrowser Loading Question

After adding a WebBrowser control to my form (VS 2005), and the following 2
lines of code to a click event:

webBrowser1.Navigate(new Uri(NextURL));
String PageData = webBrowser1.DocumentText;

After stepping through the code, noticed that PageData was empty. After the
click event completed processing and exited, the web page was properly
displayed in my form. After entering the click event a 2nd time and
stepping around the Navigate line (so it was not executed), and executing
the next line, discovered that PageData appeared to hold the correct
contents of the web page.

So, my question is - does the click event always have to exit before the web
page can be properly loaded, or is there a way for the Navigate function to
be called sychronously and for the program to wait until the web page is
completely loaded before attempting to acess the DucmentText property?

I'm not really interested in displaying the contents of the webpage. I'm
using the WebBrowser control because I'm working with a web page that uses
cookies and the WebBrowser control appears to handle those cookies properly
by default much like IE. I tried using the WebRequest and WebResponse
classes, but then discovered that these classes don't handle cookies by
default. What I'm really after is obtaining the content of the web page
into a String object so some of the content can be parsed and saved to a
text file.

Thanks for any help in advance.

Bob Bryan
Dec 27 '06 #1
0 1454

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

Similar topics

1
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...
5
by: Amir K | last post by:
Hi I'm want to catch the event where WebBrowser Control finish loading a page after navigate. The problem with document_complete event is that if the site is multi-framed then the controls...
4
by: Toma Marinov | last post by:
Hello ! I made some test with webbrowser control in VS.2005. When I load a word document in webbrowser through .Navigate method (from my hdd), I want to get the stream of the loaded doc file with...
0
by: Mark | last post by:
I am converting a VB6/COM application to VB.NET and must remove all COM objects. VB6/COM App Architecture: Windows Form hosts WebBrowser which loads HTML snippets from local disk. Some of the...
11
by: Webbert | last post by:
I am trying to display XML in a WebBrowser Control. I receive a data feed of XML and am trying to inject it into the control. I have not been successful in doing so. The only solution I have...
1
by: Sin Jeong-hun | last post by:
Is it possible to modify the HTML or the script of a WebBrowser control in DocumentCompleted event? I tried to modify it but that caused DocumentCompleted again so the program fell in an endless...
4
by: David | last post by:
I'm using the AxSHDocVw.WebBrowser control to download data from a webpage at work (it's an internal page on my company's intranet). The page produces a runtime error after a while and the...
9
by: star-italia | last post by:
Hi, I have a big problem: I am developing a WPF application on Windows Vista SP1 Based on the .NET Framework 3.5 and WPF. In my application I use a WIndowsFormsHost to (of course) host a...
6
by: Martin Slater | last post by:
Hi all, I'm using a webbrowser control within an application for the UI and want to hide the flicker and redraw when changing pages. Ideally I want to render the new page to a seperate...
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: 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
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.