Tree View
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim _node As New TreeNode
_node.Text = "Root note"
For i As Integer = 0 To 2
Dim _node_node As New TreeNode
_node_node.Text = "Child " & i
_node_node.Nodes.Add("Child" & i & "1", "Sub Child 1")
_node_node.Nodes.Add("Child" & i & "2", "Sub Child 2")
_node_node.Nodes.Add("Child" & i & "3", "Sub Child 3")
_node.Nodes.Add(_node_node)
Next
TreeView1.Nodes.Add(_node)
End Sub
Jika diklik pada treeview maka akan keluar pesan, klik Clild 1
tambahkan ke treeview event :
Private Sub TreeView1_NodeMouseClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
Select Case e.Node.Name
Case "Child01"
MsgBox("Child 1")
Case "Child11"
MsgBox("Child 2")
Case "Child21"
MsgBox("Child 3")
End Select
End Sub
Jalankan tekan F5