Managing multiple forms

  • Thread starter Thread starter john sutor
  • Start date Start date
J

john sutor

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
 
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.
 

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

Back
Top