HtmlDocument.CreateElement Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Creates a browser element.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function CreateElement ( _
    tagName As String _
) As HtmlElement
[SecuritySafeCriticalAttribute]
public HtmlElement CreateElement(
    string tagName
)

Parameters

  • tagName
    Type: System.String
    The tag name of the browser element to create.

Return Value

Type: System.Windows.Browser.HtmlElement
A reference to a browser element.

Exceptions

Exception Condition
ArgumentException

tagName is an empty string.

ArgumentNullException

tagName is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

An unexpected error occurred.

Remarks

This method creates a standalone (unparented) instance of a browser element.

Some browsers let you include additional information in the tagName parameter. For example, Internet Explorer lets you include an HTML element definition and attribute values.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.