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.
How about adding an event to your ImportForm "ImportFinished" where you pass in your values as the eventargs. This event is fired in the Close or Closing event of the ImportForm and handled in your MainWindow. 
You could also show the ImportForm as a Modal dialog and read the values when the ShowDialog method returns.