Process.OnExited Method

Raises the Exited event.

Namespace: System.Diagnostics
Assembly: System (in system.dll)

protected void OnExited ()
protected void OnExited ()
protected function OnExited ()
Not applicable.

OnExited is the API method that raises the Exited event. Calling OnExited causes the Exited event to occur and is the only way to raise the event using the Process component. OnExited is primarily used when deriving classes from the component.

As an alternative to OnExited, you can write your own event handler. You create your own event handler delegate and your own event-handling method.


If you are using the Visual Studio environment, an event handler delegate (AddOnExited) and an event-handling method (Process1_Exited) are created for you when you drag a Process component onto a form and double-click the icon. The code you create to run when the Exited event occurs is entered into the Process1_Exited procedure. You do not need to create the OnExited member, because it is implemented for you.

Raising an event invokes the event handler through a delegate. For an overview, see [<topic://cpconProvidingEventFunctionality>].

Notes to Inheritors: When overriding OnExited in a derived class, be sure to call the base class's OnExited method.

  • LinkDemand  for full trust for the immediate caller. This member cannot be used by partially trusted code.

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

.NET Compact Framework

Supported in: 2.0

Community Additions