Question: I would like to ask,

I have a window called `MainWindow` and another one called `ImportForm`.
In the `MainWindow` i call

```
private void generate_Window(int num_chart) 
{ 
    Window ownedWindow = new ImportForm(num_chart); 
    ownedWindow.Owner = this;      
    ownedWindow.Show(); 
}

```

In the child window i make some stuff and i produce some variables. like var1,var2,var3.

I want when the child window close to return `var1`,`var2`,`var3` to the `MainWindow` and call one function let's say `import_chart(var1, var2, var3)`..

Any help will be apretiated.
Thanks

Answer: 
It seems like an awkward design choice. Anyways, here is how you can do it:

MainWindow.cs:

```
private void generate_Window(int num_chart)
{
    Window ownedWindow = new ImportForm(num_chart, import_chart); 
    ownedWindow.Owner = this; 
    ownedWindow.Show();
}

private void import_chart(int n, string s, bool b)
{
    //Do something
}

```

ImportForm.cs:

```
private Action<int, string, bool> callback;
public ImportForm(int num_chart, Action<int, string, bool> action)
{
    InitializeComponent();
    Closed += ImportForm_Closed;
    callback = action;
}

private void ImportForm_Closed(object sender, EventArgs e)
{
    callback(0, "Test", false);
}

```

Just change the Action to the parameter types you need (and adjust ImportForm\_Closed(...) to use them as well).

If anything is unclear, let me know.
A simple way to do this is to make `var1`, `var2`, and `var3` instance variables that are visible in the scope of the parent (e.g. make them `public`), and then in the `MainWindow`, attach to the `Closed` event, and read the variables from `(ImportForm)sender`.