System.Windows.Forms.HtmlElement.InsertAdjacentElement Method

Insert a new element into the Document Object Model (DOM).

Syntax

public HtmlElement InsertAdjacentElement (HtmlElementInsertionOrientation orient, HtmlElement newElement)

Parameters

orient
Where to insert this element in relation to the current element.
newElement
The new element to insert.

Returns

The System.Windows.Forms.HtmlElement that was just inserted. If insertion failed, this will return null.

Remarks

Do not call this method until after the WebBrowser.DocumentCompleted event on the System.Windows.Forms.WebBrowser control has occurred. Calling this method before then can result in an exception, as the document will not have finished loading.

Whether a value of System.Windows.Forms.HtmlElementInsertionOrientation is valid will depend on the type of the element. For example, HtmlElementInsertionOrientation.AfterBegin is valid if the element is a DIV, but not if it is a SCRIPT or IMG element, neither of which can contain child elements.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0