I am trying to create a modeless dialog from an event thread not generated from the original form. When created in one of the event handlers from the form, the dialog works properly. Also it works properly if it is a modal dialog.
I made this little example that will just pop up a modeless dialog (form2) after a second.
Here's some code....
I made this little example that will just pop up a modeless dialog (form2) after a second.
Here's some code....
Code:
System.Timers.Timer timer = new System.Timers.Timer(); bool timer1 = false; Form2 c; public Form1() { InitializeComponent(); timer.Interval = 1000; timer.Elapsed += new System.Timers.ElapsedEventHandler(timertick); timer.Start(); } void timertick(object sender, System.Timers.ElapsedEventArgs e) { if (!timer1) { ProcessEvent(); timer1 = true; timer.Enabled = false; } else { timer.Stop(); } } private void ProcessEvent() { c = new Form2(); c.Show(); }
Comment