本例给TreeView控件添加“父——子——子”节点。其中,父节点为“2001年”,第一子节点为12个月份,第二子节点添加在当月下的当天日期。
Private sub Form_Load()
Dim nodX As Node Dim i As Integer Dim j As Integer TreeView1.LineStyle = tvwRootLines Set nodX = TreeView1.Nodes.Add(, , "r", "2001年") For i = 1 To 12 Set nodX = TreeView1.Nodes.Add(1, tvwChild, , i & "月") Next nodX.EnsureVisible
j = CStr(Month(Now)) Set nodX = TreeView1.Nodes.Add(j + 1, tvwChild, , CStr(Day(Now)) & "日")
End Sub  
|