ShowDialog and Load Event

G

Guest

I am trying to troubleshoot an application I inherited. On a form, there is
a button, that when clicked loads a user control with ShowDialog;

btn_Click(object sender, System.EventArgs e)
{
ucForm1 UCForm1 = new ucForm1();
UCForm1.ShowDialog(this.ParentForm);
.....
}

in the ucForm1.cs there is a Load event defined;

ucForm1_Load(object sender, System.EventArgs e)
{
.....
}

When the app runs and the user clicks the button, the dialog form appears
but the the load event is never triggered. Does the Load event not get fired
when a form is presented using the ShowDialog method? If it doesn't, is
there another event I can use to run the code that I wanted to run in the
load event? Or am I missing something?

thanks for any help you can provide.

Dan
dchman
 
G

Guest

Never mind. I deleted the load event, then recreated it, and now it works.
Not sure how it became broken.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top