Ok ive got an MDI form, on the left is a treeview than the user can select from. Upon selecting a node the appropriate form is opened as a child. If the user cancels out of the form, it closes down.

Now my question is this. If the user then decides that they want that form open again, they click on the same treeview node BUT Afterselect doesnt seem to fire, since that node was the same one as the one previously selected.

I can use the click even but when you look at the treeviews Selected Node property it only holds the last selected node, if you changed nodes it holds a reference to the old one. Which is no good. Plus , Click fires, followed by After Select which opens a form twice. Not good.

I just want the form to open again if the user clicks the same node as the one they selected previously. Hope you can understand this , its not very clear!

Heres my code...

Private Sub TreeView1_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect

OpenForm(TreeView1.SelectedNode, Me.ActiveMdiChild)

End Sub

Private Sub TreeView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles TreeView1.Click

If Not TreeView1.SelectedNode Is Nothing Then

OpenForm(TreeView1.SelectedNode, Me.ActiveMdiChild)

End If

End Sub