When does the form goes destructed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Boni

    When does the form goes destructed

    Hi All,
    I have a form, where user can fill some fields and then press "OK". On the
    OK-button I have

    this->close();
    if (this->field1.text==a ) ...
    It seems to work. But as far as I understand MSDN the form goes with "close"
    not only unvisible but also can be destructed. I am right? What is the
    proper way to handle such UI?
    Thanks,
    Boni


  • Cor Ligthert

    #2
    Re: When does the form goes destructed

    Boni,

    The form will be destructed when the garbage collector does that, however
    because that it is a part of the managed code you should not watch for that.

    With one exception.
    When it is a modal (dialogform), than you can better use
    frm.dispose instead of the frm.close

    To see if you still can use a form you can test with

    Isdisposed


    I hope this helps,

    Cor


    Comment

    Working...