This is a migrated thread and some comments may be shown as answers.

FormClosing event fires twise

3 Answers 158 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Constantinos Petridis asked on 02 Feb 2011, 04:52 PM
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 :)

3 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 02 Feb 2011, 05:47 PM
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
0
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
answered on 02 Feb 2011, 06:12 PM
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).
0
Richard Slade
Top achievements
Rank 2
answered on 02 Feb 2011, 06:16 PM
Glad that I could help. Please remember to mark as answer and if you have further questions, please let me know
Regards,
Richard
Tags
Dock
Asked by
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Answers by
Richard Slade
Top achievements
Rank 2
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Share this question
or