HtmlDocument.Write(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Writes a new HTML page.
public:
void Write(System::String ^ text);
public void Write (string text);
member this.Write : string -> unit
Public Sub Write (text As String)
Parameters
- text
- String
The HTML text to write into the document.
Examples
The following code example opens a new HtmlDocument and writes in a new HTML file.
private void WriteNewDocument()
{
if (webBrowser1.Document != null)
{
HtmlDocument doc = webBrowser1.Document.OpenNew(true);
doc.Write("<HTML><BODY>This is a new HTML document.</BODY></HTML>");
}
}
Private Sub WriteNewDocument()
If (WebBrowser1.Document IsNot Nothing) Then
Dim doc As HtmlDocument = WebBrowser1.Document.OpenNew(True)
doc.Write("<HTML><BODY>This is a new HTML document.</BODY></HTML>")
End If
End Sub
Remarks
All calls to Write should be preceded by a call to OpenNew, which will clear the current document and all of its variables. Your calls to Write will create a new HTML document in its place. To change only a specific portion of the document, obtain the appropriate HtmlElement and set its InnerHtml property.
It is recommended that you write an entire valid HTML document using the Write method, including HTML
and BODY
tags. However, if you write just HTML elements, the Document Object Model (DOM) will supply these elements for you.