Muscial Forms

D

David Webb

Hi,

I seem to have stale forms that want to pop up. My main form is called
frmSplash. If I go to another form, then exit the form, I return to
frmSplash. This is normal. However, a custom DLL that I use (written
by another team member) fires an event when a certain action takes
place, and the frmComms form appears over the top of frmSplash, when
frmSplash was the form that was showing at the time the event was
raised. Is there any way I can really hide the form? I don't want to
dispose of it as I may need to use it again. This is happening to
other forms as well.

Any help would be greatly appreciated.

Regards,

David.
 
C

Charles Gifford [MSFT]

Hi David -

What event is the custom DLL firing, and where is the appropriate handler
for that event located within your Winforms app?

You could something similar to the following in order to ensure that your
frmSplash form comes up from within each of the forms that comprise your
app - the example below assumes that a combobox1 control resides within
each of the forms, and changing the value of the combobox triggers the
event that the code responds to:

private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs
e)
{
if(this.comboBox1.SelectedIndex == 0)
{
this.f1.Show();
}
else if (this.comboBox1.SelectedIndex == 1)
{
if(this.f1.f2 == null)
{
this.f1.f2 = new Form2();
this.f1.f2.f1 = this.f1;
}
this.f1.f2.Show();
}
else
{
// do nothing already in focus
}
}

Let me know if this info and sample helps.

- Charlie

This posting is provided "AS IS" with no warranties, and confers no rights.
 

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