blah blah blah is here! blah blah » Close

up0down
link

Hi,
i'm trying to close a form after i finished an operation, like:

Form1 
-----
Form2 f2 = new Form2();
f2.Show();


Form2
-----
(onButtonClick)
this.Hide();


But when it is closed (after 3-4 seconds!!!! and it has only a textbox and a button)
and the control is on the main form, form1, it became too much slowly... really too much?
This is cause i'm not closing the form2 but just hiding that?

Can you help me with this?

Daniel

last answered one year ago

1 answers

link

It sounds like you should be using Form2 as a modal dialog:

Form2 f2 = new Form2();
f2.ShowDialog();


This will block the code until f2 is closed. You therefore also need to change this.Hide() to this.Close() in Form2's button click eventhandler

Feedback