FormClosing event fires twise

4 posts, 1 answers
  1. Constantinos Petridis
    Constantinos Petridis avatar
    21 posts
    Member since:
    May 2010

    Posted 02 Feb 2011 Link to this post

    Good afternoon Telerik :)

    There seems to be a problem with form closing events when using RadDock with MDI forms and AutoDetectMdiChildren. When I call the Close function of a docked form, the Closing event of the form is call twice. This does not happen when I close the form from the RadDock control (for example, with middle click on the tab document). This is a link to a project that demonstrates this problem.
    This behavior breaks our data checking process (unsaved or invalid data etc).

    Additionaly if someone cancels (setting the e.Cancel property of CancelEventArgs to true) the closing process on the second fire of the event, the form will close but the docking document will remain open.

    I am using the latest trial release (Q3 2010).

    Thank you in advance for the answer Telerik team :)
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Feb 2011 Link to this post

    Hello,

    I have tried your project. Please can you add the following code to your RadForm (MDIChild)

    Private Sub RadFormClosed(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Closed
        MyBase.Parent.Dispose()
        MyBase.Dispose()
    End Sub

    Hope that hels but let me know if you need more help
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Constantinos Petridis
    Constantinos Petridis avatar
    21 posts
    Member since:
    May 2010

    Posted 02 Feb 2011 Link to this post

    Thanks for the quick response, Richard (and the workaround). :)

    Yes, the code snippet you've provided does solve the problem. My workaround was similar, but calling only
    MyBase.Parent.Dispose()
    I wanted to include it in my original post... but forgot it.

    Thank you again Richard and I will wait for Telerik's answer on this issue (if and/or when will it be fixed).
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Feb 2011 Link to this post

    Glad that I could help. Please remember to mark as answer and if you have further questions, please let me know
    Regards,
    Richard
Back to Top