0
I want when Form1 is opened, the whole program stops, and only comes back when it is closed. How can I do this?
Code that opens Form1:
if (x == DialogResult.Yes)
{
Form1 f1 = new Form1();
f1.Show();
}
0
I want when Form1 is opened, the whole program stops, and only comes back when it is closed. How can I do this?
Code that opens Form1:
if (x == DialogResult.Yes)
{
Form1 f1 = new Form1();
f1.Show();
}
1
To "block" the application while waiting for the result of Form1
, swap the .Show
for .ShowDialog()
.
Browser other questions tagged c# .net winforms
You are not signed in. Login or sign up in order to post.
I tried to do that, it even worked, but it’s just that inside the
Form1.cs
, I have a function that assigns some values within a combobox, and when I open with thef1.ShowDialog()
he doesn’t perform it.– Francisco
this function is running at what time ? use the Form1 Load event
– Rovann Linhalis
Yes, it’s in the load.
– Francisco
If you can, post the Form code
– Rovann Linhalis
This is the entire code: https://gist.github.com/ceifa/36c0771bc0757ec954118493ffd56a07
– Francisco
and without Showdialog it works ?
– Rovann Linhalis
Yes, if I put it to him to be the first form to boot, it works normally.
– Francisco
so you don’t just change Showdialog to Show, you change something else in the code... ?
– Rovann Linhalis
No. I change nothing.
– Francisco
Put a point break in the code and check if the values of the Skins variables. x are not empty
– Rovann Linhalis
No, they are not empty, as I said, if I put to be the first form to start, everything works perfectly.
– Francisco