I tried something like that :
That is the code of my program.cs
:
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form f = new Form2();
if(f.DialogResult == DialogResult.OK)
Application.Run(new Form1());
I don' t know why that doesn't work. Any form isn't shown.
I don' t know why that doesn't work. Any form isn't shown.
Because you are checking the dialogresult without actually showing the form to the user and asking him to press ok or cancel.
do it like this
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form f = new Form2();
if(f.ShowDialog() == DialogResult.OK) // note the change here.
Application.Run(new Form1());