This documentation is archived and is not being maintained.

EventHandlerService Class

Provides a systematic way to manage event handlers for the current document.

Namespace: System.Windows.Forms.Design
Assembly: System.Design (in

public sealed class EventHandlerService
public final class EventHandlerService
public final class EventHandlerService
Not applicable.

Developers may want to be able to write code in one place that handles events of a certain type.

Also, developers may need to globally change the behavior of the handlers for specific events or types of events, which may be distributed among designer components.

The designers for a typical project are many different objects so it can be useful to list and store reference to these events from a common place.

This service implements an "event stack" that contains the current set of event handlers. The stack may have a variety of different types of handlers on the stack.

For example, a designer might push, or add, a keyboard handler and a mouse handler onto the stack. When a designer requests an event handler, the service will find the topmost handler on the stack that matches the class you requested.

This way the service can be extended to any eventing scheme, and it also allows specific types of event handlers to be replaced. For example, you can replace mouse event handlers without affecting menu event handlers or keyboard event handlers.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0