473,761 Members | 10,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WebBrowser and HTML capture (ignore previous)

Sorry, I attempted to tab in the previous post and accidentally posted
prematurely.

I am trying to use the WebBrowser control from Visual Studio 2005 to load a
web page and display its HTML content in a text box on a Form of a Windows
Application. I have a button on the Form that invokes the following code
when clicked:

webBrowser1.Url = new Uri("http://www.microsoft.c om");
textBox1.Text = webBrowser1.Doc umentText;

However, this does not work because the page does not actually load until
the button click method has returned. To actually load and display the page,
I have to click the button twice and do this:

if (toggle == 0)
{
webBrowser1.Url = new Uri("http://www.microsoft.c om");
toggle = 1;
}
else
{
textBox1.Text = webBrowser1.Doc umentText;
toggle = 0;
}

I want to capture the page contents with a single button click, but I
suspect I will have to do something in a thread or use invoke or something.
Can someone give me an example of how to do this?

Thanks in advance,
Don
Nov 17 '05 #1
2 7951
Don,

What I would do is create an event handler for the DocumentComplet ed
event, and when that event is fired, set the text to the source. It
wouldn't prevent the button from being clicked twice, but it wouldn't matter
that much, since it would just cause the page to be reloaded, and the event
to be fired again (the state wouldn't be corrupted).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Don Tucker" <Do*******@disc ussions.microso ft.com> wrote in message
news:CF******** *************** ***********@mic rosoft.com...
Sorry, I attempted to tab in the previous post and accidentally posted
prematurely.

I am trying to use the WebBrowser control from Visual Studio 2005 to load
a
web page and display its HTML content in a text box on a Form of a Windows
Application. I have a button on the Form that invokes the following code
when clicked:

webBrowser1.Url = new Uri("http://www.microsoft.c om");
textBox1.Text = webBrowser1.Doc umentText;

However, this does not work because the page does not actually load until
the button click method has returned. To actually load and display the
page,
I have to click the button twice and do this:

if (toggle == 0)
{
webBrowser1.Url = new Uri("http://www.microsoft.c om");
toggle = 1;
}
else
{
textBox1.Text = webBrowser1.Doc umentText;
toggle = 0;
}

I want to capture the page contents with a single button click, but I
suspect I will have to do something in a thread or use invoke or
something.
Can someone give me an example of how to do this?

Thanks in advance,
Don

Nov 17 '05 #2
That was easy and did the trick. Thanks!
Don

"Nicholas Paldino [.NET/C# MVP]" wrote:
Don,

What I would do is create an event handler for the DocumentComplet ed
event, and when that event is fired, set the text to the source. It
wouldn't prevent the button from being clicked twice, but it wouldn't matter
that much, since it would just cause the page to be reloaded, and the event
to be fired again (the state wouldn't be corrupted).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Don Tucker" <Do*******@disc ussions.microso ft.com> wrote in message
news:CF******** *************** ***********@mic rosoft.com...
Sorry, I attempted to tab in the previous post and accidentally posted
prematurely.

I am trying to use the WebBrowser control from Visual Studio 2005 to load
a
web page and display its HTML content in a text box on a Form of a Windows
Application. I have a button on the Form that invokes the following code
when clicked:

webBrowser1.Url = new Uri("http://www.microsoft.c om");
textBox1.Text = webBrowser1.Doc umentText;

However, this does not work because the page does not actually load until
the button click method has returned. To actually load and display the
page,
I have to click the button twice and do this:

if (toggle == 0)
{
webBrowser1.Url = new Uri("http://www.microsoft.c om");
toggle = 1;
}
else
{
textBox1.Text = webBrowser1.Doc umentText;
toggle = 0;
}

I want to capture the page contents with a single button click, but I
suspect I will have to do something in a thread or use invoke or
something.
Can someone give me an example of how to do this?

Thanks in advance,
Don


Nov 17 '05 #3

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

Similar topics

0
1699
by: Carl Manson | last post by:
Hi All, I am writing a complex print job solution that requires the printing of many HTML documents in an exactly defined order. Our application uses the IE WebBrowser control to render the documents, then fire them off to the printer. It is all fully automated, so no user interaction is required. However, some documents are larger than others and take longer to spool. The standard behaviour of spoolers/print queues is FIFO, but
9
3812
by: ASP .NET Newbie | last post by:
How can I run a WebBrowser control using ASP.NET/VB.NET? I know I can use the WebClient to get the page data, but I need to be able to use the WebBrowser (AxWebBrowser)? Thanks, Chad
0
1686
by: Vin | last post by:
The .Net 2.0's webbrowser is neat and pretty. But I am not able to capture Key events when the focus is on the webbrowser control in my winform. Options tried. 1. Wrote a class which extends this WebBrowser and override its onkeyup event - didn't work. 2. Same as option 1 but override preprocessmessage - didn't work. 3. Same as option 1 but override WndProc - doesn't capture any key events happening in the browser.
8
3419
by: Prosperz | last post by:
Hi, I would like to make thumbnails of web page by capture content of a WebBrowser. By example, capture http://www.google.com. I used WebBrowser control with Framework 2.0. I try this : *************************************************
4
1445
by: ejder | last post by:
I am writing a program. I am using webbrowser. I implement webbrowser but I need to capture posted data from webbroser . soo when I visiting site on my webbrowser , For example I enter membership system and I enter my pwd, my username . And I want to capture what it send? like that ->> user=ejder&pwd=123456&id=33 like that. I want to capture posted data from my webbrowser if it post data ?? how can I do it.
1
4507
by: JP2006 | last post by:
I'm trying to write a control that will take a screen capture of a particular website when a user submits a form in a web application; one of the form fields is for a URL - the control needs to get an image of that web site so that it can be displayed later as a thumbnail image. I have code for taking a normal screen capture using GDI+ which works fine. What I am now trying to do is to modify it so the screen capture is of a remote...
0
2025
by: =?Utf-8?B?c25naWxi?= | last post by:
I am having 3 issues with the WebBrowser control which may all be related. The HTML for the page is the standard Weather Magnet from weather.com. The actual HTML is at the bottom of this page. Issue 1: I am opening a page in the control in the development environment and the document comes up correctly. But, when I click a link in the resulting document, an external IE instance comes up with the requested page. I have see reference to...
2
5858
by: =?Utf-8?B?c25naWxi?= | last post by:
The WebBrowser control is described as exposing numerous public mouse events. See: http://msdn2.microsoft.com/en-us/library/ayestehw.aspx. many of the event are described as: "This event is not supported by this control. (inherited from WebBrowserBase)". Does this mean that I can't access these? I am using VS Express C#. Otherwise how do I capture webBrowser mouse events? I am trying to have a DISPLAY-ONLY browser window (i.e. no...
4
13368
by: Robson Siqueira | last post by:
Folks, I am facing a problem. I am trying to manipulate the HTML data (thru the Document and DocumentText properties) of the WebBrowser object (System.Windows.Forms). The problem is that the application enters in a loop state and my changes don't apply. Have somebody faced the same problem? Any solutions?
0
9531
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
9345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10115
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
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7332
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
5229
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...
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2752
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.