# Re: 大约如下, 其它自己Try看看啰

Posted by Ocean on June 03, 1999 at 16:01:42:

In Reply to: 有没有范例来说明 posted by 小曼 on June 02, 1999 at 16:19:28:

: 可以请你用范例来说明

: : 妳可以用 .Children, .Parent
: : 去判断妳所需的资料

Option Explicit

Private Sub Form_Load()

TreeView1.Nodes.Add , tvwLast, "Test1"
TreeView1.Nodes("Test1").Text = "Test1"
TreeView1.Nodes.Add "Test1", tvwChild, "C_Test1"
TreeView1.Nodes("C_Test1").Text = "C_Test1"
TreeView1.Nodes.Add , tvwLast, "Test2"
TreeView1.Nodes("Test2").Text = "Test2"
TreeView1.Nodes.Add , tvwLast, "Test3"
TreeView1.Nodes("Test3").Text = "Test3"
TreeView1.Nodes("Test1").Expanded = True
End Sub

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If Node.Child Is Nothing Then
If Node.Parent Is Nothing Then
MsgBox "It's the Root Point"
Else
MsgBox "It's the Child Point"
End If
Else
If Node.Parent Is Nothing Then
MsgBox "It's the Root Point"
Else
MsgBox "It's the Child and Parent Point"
End If
End If
End Sub

Follow Ups: