cat
cat

Reputation: 33

How can I execute code after form close?

I have the following code in my project:

{
    Lib.Settingsform f = new Lib.Settingsform();
    f.Show();
    LoadSettings();  
    InitializeInterface();
}

I want to call above methods after f.Show() when the form closes but they run at the same time.

What am I doing wrong?

Upvotes: 0

Views: 989

Answers (1)

Cory
Cory

Reputation: 1802

I believe you want to use ShowDialog()

using (Lib.Settingsform f = new Lib.Settingsform())
    f.ShowDialog();

LoadSettings();
InitializeInterface();

This will block the thread until the form is closed.

Upvotes: 1

Related Questions