Hi,

Maybe this is a simple question...

I want to open a 2nd form using a load click button. I already did it:

private void loadbtt_Click(object sender, EventArgs e)
{
ScndForm.Show();
ScndForm.Update();

// Rest of the instructions for load button
}

The problem is that it is only showing the 2nd form and not waiting if it is closed or if the operation inside it had any error, it just go to the rest of the instructions in the load button section...
I want to do it without a Global Variable, should is possible?

Recommended Answers

All 2 Replies

Without knowing more about what you are trying to do (Do you want Update() to run right after you show the form, or after the user is finished with the form) it's hard to help. But, if you want the user to have to deal with form two and close it (however you allow them to do that), then use ShowModal(), as in ScndForm.ShowModal(); . The code in loadbtt_Click will stop at the ShowModal() line and wait for the ScndForm to close.

Without knowing more about what you are trying to do (Do you want Update() to run right after you show the form, or after the user is finished with the form) it's hard to help. But, if you want the user to have to deal with form two and close it (however you allow them to do that), then use ShowModal(), as in ScndForm.ShowModal(); . The code in loadbtt_Click will stop at the ShowModal() line and wait for the ScndForm to close.

Hey that worked. Instead of using ShowModal() I used ShowDialog() because the first one was not in the options.

I want to ScndForm.Update(), after the user put some parameters in the 2nd form and for update the variables with the user content.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.