# CustomFormContext class
{: .no_toc }

The form-class counterpart to [**CustomControlContext**](/tB/Packages/CustomControls/Framework/CustomControlContext.md). Extends the base context with **Show** and **Close** --- the operations a top-level custom form needs that an embedded control does not.

A custom form class receives a [**CustomFormContext**](/tB/Packages/CustomControls/Framework/CustomFormContext.md) through its [**ICustomForm.Initialize**](/tB/Packages/CustomControls/Framework/ICustomForm.md#initialize) method. It stores that reference and delegates its own **Show** and **Close** methods to the corresponding context methods. The underlying COM interface is [**_CustomFormContext**](/tB/Packages/CustomControls/Framework/_CustomFormContext.md).

```tb check_build
Private m_Context As CustomControls.CustomFormContext

Private Sub OnInitialize(ByVal Ctx As CustomControls.CustomFormContext) _
        Implements CustomControls.ICustomForm.Initialize

    Set m_Context = Ctx
End Sub

Public Sub Show()
    m_Context.Show
End Sub

Public Sub Close()
    m_Context.Close
End Sub
```

## Inherited

A **CustomFormContext** includes every member from [**CustomControlContext**](/tB/Packages/CustomControls/Framework/CustomControlContext.md) --- [**GetSerializer**](/tB/Packages/CustomControls/Framework/CustomControlContext.md#getserializer), [**Repaint**](/tB/Packages/CustomControls/Framework/CustomControlContext.md#repaint), [**CreateTimer**](/tB/Packages/CustomControls/Framework/CustomControlContext.md#createtimer), and [**ChangeFocusedElement**](/tB/Packages/CustomControls/Framework/CustomControlContext.md#changefocusedelement) --- and adds the two form-specific members below.

## Methods

### Close
{: .no_toc }

Closes the underlying window. Equivalent to the user clicking the title-bar close button.

Syntax: *object*.**Close** ( )

Application code typically calls [**WaynesForm.Close**](/tB/Packages/CustomControls/WaynesForm/index.md#close), which in turn calls this method through the stored **CustomFormContext** reference.

### Show
{: .no_toc }

Makes the underlying window visible.

Syntax: *object*.**Show** ( )

Application code typically calls [**WaynesForm.Show**](/tB/Packages/CustomControls/WaynesForm/index.md#show), which in turn calls this method through the stored **CustomFormContext** reference.

## See Also

- [_CustomFormContext](/tB/Packages/CustomControls/Framework/_CustomFormContext.md) interface -- the COM interface this CoClass exposes as its default
- [CustomControlContext](/tB/Packages/CustomControls/Framework/CustomControlContext.md) class -- the base context for embedded custom controls
- [ICustomForm](/tB/Packages/CustomControls/Framework/ICustomForm.md) interface -- the interface a custom form class implements; receives a **CustomFormContext** in **Initialize**
- [WaynesForm](/tB/Packages/CustomControls/WaynesForm/index.md) -- the built-in custom form that uses **CustomFormContext**
