I have been tweaking my program all day and I am having a problem hiding a form which will pop up saying “Please wait”
For example:
private void button12_Click(object sender, EventArgs e)
{
form2 wait = new form2();
pw.Show();
}
private void button13_Click(object sender, EventArgs e)
{
form2 wait = new form2();
pw.Hide();
}
This will not work, although I am sure this isn’t news to the casual C# programmer. Is there a simple way to do what I am attempting? I have tried searching online and I did find something although I wasn’t 100% sure what they were trying to do. I was going to find an example to show you but I closed page – Typical. However I think they were trying to overide the show and give you control over the .show with a bool?
The code isn’t working as you expect it to because the
form2inside ofbutton12_Clickis different from theform2inside ofbutton13_click. Notice that you are using thenewkeyword twice. So inbutton13_click, you are creating a newform2, and then hiding it, even though you haven’t even shown it yet!Instead you can create a single
form2instance to share between your two methods: