Assembly: System.Windows.Forms (in system.windows.forms.dll)
/** @property */ public String get_DocumentText () /** @property */ public void set_DocumentText (String value)
public function get DocumentText () : String public function set DocumentText (value : String)
Property ValueThe HTML text of the displayed page, or the empty string ("") if no document is loaded.
Use this property when you want to manipulate the contents of an HTML page displayed in the WebBrowser control using string processing tools. You can use this property, for example, to load pages from a database or to analyze pages using regular expressions. When you set this property, the WebBrowser control automatically navigates to the about:blank URL before loading the specified text. This means that the Navigating, Navigated, and DocumentCompleted events occur when you set this property, and the value of the Url property is no longer meaningful.
This property contains the text of the current document, even if another document has been requested. If you set the value of this property and then immediately retrieve it again, the value retrieved may be different than the value set if the WebBrowser control has not had time to load the new content. You can retrieve the new value in a DocumentCompleted event handler. Alternatively, you can block the thread until the document is loaded by calling the System.Threading.Thread.Sleep method in a loop until the DocumentText property returns the value that you originally set it to.
Windows Mobile 2003 for Pocket PC, Windows Mobile 2003 for Smartphone, Windows CE Platform Note: The .NET Compact Framework does not support using DocumentText to get the content of a Web page, but you can use it to present HTML to your users, such as to provide links and a simple HTML form. For a code example, see How to: Use a WebBrowser Control.
The following code example demonstrates how to use the DocumentText property to programmatically display document content of your choosing. This example requires that your form contains a WebBrowser control called webBrowser1.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.