Export (0) Print
Expand All

HtmlElement.AttachEventHandler Method

Note: This method is new in the .NET Framework version 2.0.

Adds an event handler for a named event on the HTML Document Object Model (DOM).

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public void AttachEventHandler (
	string eventName,
	EventHandler eventHandler
)
public void AttachEventHandler (
	String eventName, 
	EventHandler eventHandler
)
public function AttachEventHandler (
	eventName : String, 
	eventHandler : EventHandler
)

Parameters

eventName

The name of the event you want to handle.

eventHandler

The managed code that handles the event.

The Managed Document Object Model (DOM) exposes only a select number of events. Most of the unexposed events are only defined for specific types of elements; such as the submit event, which is valid only on FORM elements. Use AttachEventHandler to add an event handler to these unexposed events.

You should not attach an event to the document or one of its objects until the document has completed loading. The earliest you should call this method is in the DocumentCompleted event of the WebBrowser control.

Windows 98, Windows 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 Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2015 Microsoft