# \[FAQ\] WinForms Dialog Closes Immediately When Registered as an io.Connect Flyer Window

**URL:** <https://community.interop.io/t/faq-winforms-dialog-closes-immediately-when-registered-as-an-io-connect-flyer-window/699>\
**Category:** io.Connect Desktop\
**Tags:** FAQs, NET, iocd-9\
**Created:** [October 7, 2026, 2:28pm UTC](https://community.interop.io/t/faq-winforms-dialog-closes-immediately-when-registered-as-an-io-connect-flyer-window/699 "2026-10-07T14:28:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![toni.petrov](https://yyz2.discourse-cdn.com/flex028/user_avatar/community.interop.io/toni.petrov/32/17_2.png) [@toni.petrov](https://community.interop.io/u/toni.petrov)\
**Post date:** [October 7, 2026, 2:28pm UTC](https://community.interop.io/t/faq-winforms-dialog-closes-immediately-when-registered-as-an-io-connect-flyer-window/699/1 "2026-10-07T14:28:23Z")

</div>

## Problem

A WinForms view is opened as a modal dialog with `Form.ShowDialog(IWin32Window owner)`. After the dialog is shown, it is registered as an io.Connect flyer window with:

```auto
Task<IGlueWindow> RegisterWindow(IntPtr handle, GlueWindowOptions options = null, object contextCookie = null)

```

Instead of staying open, the dialog flickers and closes itself with `DialogResult.Cancel`, even though the user didn’t interact with it.

## Cause

The dialog is first shown as a normal modal dialog via `ShowDialog()`. `RegisterWindow()` is then called on the already-open dialog to turn it into a flyer window, and the dialog closes at that point.

## Solution

Don’t register a dialog that is already open via `ShowDialog()`. Show the dialog through the dialog methods on `IGlueWindow` instead:

```auto
Task<T> ShowDialogAsync<T>(IntPtr handle, Func<T> showDialogImpl, GlueDialogOptions options = null);
Task<bool?> ShowWindowDialogAsync<T>(Func<T> windowDialog, GlueDialogOptions options = null) where T : Window;
Task<DialogResult> ShowFormDialogAsync<T>(Func<T> windowDialog, GlueDialogOptions options = null) where T : Form;
bool? ShowDialog(Window window, GlueDialogOptions options = null);
DialogResult ShowDialog(Form form, GlueDialogOptions options = null);

```

For WinForms, use `ShowFormDialogAsync` or `ShowDialog(Form, GlueDialogOptions)`.

Example:

```csharp
if (glueWindow_.ShowDialog(new Form
    {
        Text = "You sure you want to do this?"
    }) == System.Windows.Forms.DialogResult.Cancel)
{
    return;
}

```

* * *

_Have a question about io.Connect Desktop window management? Post it in the [io.Connect Desktop category](https://community.interop.io/c/io-connect-desktop/4)._
