disposing form...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • libish
    New Member
    • Oct 2008
    • 42

    disposing form...

    hi all...
    i have an application... where i'm creating forms dynamically...
    once i created the forms what i'm doing is that, i'm calling
    Code:
    formob.show();
    here everything works perfect..
    but the thing is that all the form is open !!! one behind the other...
    but i need only one form at a time to be displayed and i dont want the rest of forms anymore
    i kno there are many methods to avoid this situation.. like
    Code:
    formob.close()
    etc...
    but the thing is that i fail to implement it correctly....
    can any one help me out of this...
    can any one show me some sample codes....
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Do you receive an error? What is the problem? Can you just hide the form instead of closing it?

    Comment

    • markmcgookin
      Recognized Expert Contributor
      • Dec 2006
      • 648

      #3
      Hi,

      When you create a new form you tend to create it ontop of another form. The only way to close the previous form is to pass the form to the new form in the constructor, then close it that way. Depending on how you have launched your new form this may close it too, if it belongs to the parent. I'm not 100% sure to be honest.

      on a form
      Code:
      this.close()
      will close a form, but if you pass the form to your new form you will have to do something like
      Code:
       m_parent.close()
      where m_parent is what you called the received form in the new form's constructor.

      Comment

      Working...