I've tried what you've just suggested but I still get the same "skipping" effect. Here's my AddHandler code:
Is there some way to dynamically remove a form from an MdiChildren collection directly?Code:Private Sub RunescapeToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RunescapeToolStripMenuItem1.Click Dim F As New frmRunescape F.MdiParent = Me AddHandler F.FormClosed, AddressOf ChildFormClosed F.Show() RefreshWindows() End Sub Private Sub ChildFormClosed(ByVal sender As Object, ByVal e As EventArgs) Dim c As frmRunescape c = DirectCast(sender, frmRunescape) RefreshWindows() End Sub
EDIT: I think I know what the problem is. I added a pause to the AddHandler as well as the Form_Closed event for debugging . It seems that both events are not raised while the form is completely closed, but instead it's raised right before the form closes. So, by adding code into Form_Closed, it doesn't do anything since the form is still open and technically part of the MdiChildren collection.




Reply With Quote