I'm trying to open a new form from within an event handler in the main form in a C# program. The event handler gets called properly and it opens the new form, but the new form is frozen and doesn't even initially populate.
I can create a button on the main form and have the new form created after the button is clicked, but it is not working properly when done from the event handler.
The event handler doesn't need to know the results of anything done on the form it creates - it just needs to create it and get out of the way.
What do I need to do? The new form needs to operate independently of the main form.
Here's where I define the event handler:
ibclient.RealTimeBar += new EventHandler<RealTimeBarEventArgs>(ibclient_RealTimeBar);
Here's the event handler code:
void ibclient_RealTimeBar(object sender, RealTimeBarEventArgs e)
{
FancyForm a_fancy_form = new FancyForm();
a_fancy_form.Show();
}
Creating a new form via a button click works fine:
private void button7_Click(object sender, EventArgs e)
{
FancyForm a_fancy_form = new FancyForm();
a_fancy_form.Show();
}