Question treeview node problem

abhit_kumar

Member
Joined
Aug 13, 2008
Messages
19
Programming Experience
Beginner
Dear All experts,

In my window applicaiton i have one Treeview in which i have made one root and under that 2 child node.

Now when i click to any child node a new window form get open, but the problem is that when its open its get minimised, everthough that form property is set window.state=normal and start position=Center Screen.

Below see the event through which i have opened the new form from node.

VB.NET:
Private Sub TreeView1_NodeMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
        If e.Node.Text.Equals("Create Database") Then
            Dim DB As New Form1
            DB.Show()
        End If
    End Sub

Please help.

Regards,
AKM
 
I would not use the NodeMouseClick event. I would use the AfterSelect event. Pretty sure you do not want to the event to fire when expanding or collapsing nodes..
Like this

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

Dim Node As TreeNode
Node = Me.TreeView1.SelectedNode

Debug.WriteLine(Node.Tag)
Debug.WriteLine(Node.Name)

Dim Frm As New Form1
Frm.Show()

End Sub
 
Back
Top