HtmlDocument::GetElementById Method (String^)

 

Retrieves a single HtmlElement using the element's ID attribute as a search key.

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

public:
HtmlElement^ GetElementById(
	String^ id
)

Parameters

id
Type: System::String^

The ID attribute of the element to retrieve.

Return Value

Type: System.Windows.Forms::HtmlElement^

Returns the first object with the same ID attribute as the specified value, or null if the id cannot be found.

If there are multiple elements in the document with the same ID value, GetElementById will return the first one it finds.

The following code example retrieves a named TABLE from a document, counts up the number of rows, and displays the result in the Web page. The code example requires that you have a WebBrowser control in your project named WebBrowser1, and that you have loaded a Web page with a TABLE whose ID attribute is Table1.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: