> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ninjatrader.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ninjatrader.com/_mcp/server.

# CleanUp()

## Definition

Unregisters LinkControls (**IInstrumentProvider**) and calls **Cleanup()** on **ICleanable** controls on the **NTTabPage**. Override this to, e.g., unsubscribe from events or perform any other cleanup operations when the tab is closed.

When overriding **Cleanup()**, it is strongly recommended when you call **base.Cleanup()** which ensures any link controls are also unregistered. The base implementation will also handle cleaning up any controls which implement **ICleanable**: **AccountSelector**, **AtmStrategySelector**, **InstrumentSelector**, **IntervalSelector**, **TifSelector**.

## Method Return Value

This method does not return a value.

## Syntax

`public override void Cleanup()`

## Parameters

This method does not accept any parameters.

## Examples

```csharp
public override void Cleanup()
{
    // unregister from any custom events
    Connection.ConnectionStatusUpdate -= OnConnectionStatusUpdate;

    // a call to base.Cleanup() will loop through the visual tree looking for all ICleanable children
    // i.e., AccountSelector, AtmStrategySelector, InstrumentSelector, IntervalSelector, TifSelector,
    // as well as unregister any link control events

    base.Cleanup();
}
```