ShowDialog and Load Event

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Never mind. I deleted the load event, then recreated it, and now it works.
Not sure how it became broken.
 
Back
Top