tags:

views:

71

answers:

1

I have two windows form in C# . f1 calls f2.I use message box.if the user press 'ok' , the program most restart f2 again and if press 'cancel',program close f2. for pressing 'ok' : I couldn't use 'Application.restart()',because all program restarted and I just want to restart f2. when I use " f2 f=new(); f.show();this.close();" all program closed.

please learn to me how can I solve this problem? thank you.

A: 

Don't do this.Close(); after showing f. Instead, just hide your form.

f2 f = new f2();
f.Show();
this.Hide();

f1 will they stay running and you can reuse it.

OJ
excuse me .now I test f2 f=new(); f.show();this.close(); again and it worked .I don't know why before now it doesn't worked. I 'm so sorry.
mahnaz
when I used "this. hide()",f2 didn't close until application exited.
mahnaz