469,963 Members | 2,643 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Managing multiple forms

I have a main form in a project that launches other forms. How do I ensure
that the same form does not get launched twice without killing the orignal
form. I other words I need a method to manage multiple forms in an app.

Thanks

John
Nov 15 '05 #1
1 2044
John,

Have the forms register themselves in a Hashtable that is static on a
class. When you want to create a new form or view an existing one, check
the hashtable. If the form is in the hashtable, then use that, otherwise,
create a new one and use that. Just make sure that if you create a new
form, you add it to the hashtable.

As for what you key the hashtable on, if all of your forms are different
types, then key on the type of the form. The value is always the instance
of the form.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"john sutor" <jo********@cinfin.com> wrote in message
news:uf**************@tk2msftngp13.phx.gbl...
I have a main form in a project that launches other forms. How do I ensure that the same form does not get launched twice without killing the orignal
form. I other words I need a method to manage multiple forms in an app.

Thanks

John

Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Eliezer Figueroa | last post: by
1 post views Thread by Cliff Williams | last post: by
4 posts views Thread by Simon Matthews | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.