Check whether a form is valid.

When using modeless forms the user can close  the form manually. Use the created property to check whether this is the case.

Example:

class Form1 : Form
{
   Form2 modelessForm = null;

   //On mouse click show Form2
   void onMouseClick(MouseButtons button, int x, int y)
   {
      if (modelessForm == null || !modelessForm.Created)
      {
         modelessForm = new Form2()
      }

      modelessForm.Show();
   }
}
Lastest update in March 2012, inital post in March 2012

Write a comment

I appreciate comments, suggestions, compliments etc. Unfortunately I have no time to reply to them. Useful input will be used for sure!