# TreeView可以排序吗?

Posted by 巨蟹座女子 on February 19, 1998 at 03:59:36:

在TreeView1.Nodes.Add时, 新增的Node只能放在最后, 不能依A到Z
排序. 还有, 目前资料库只有约300笔Records, 就要花大概十秒钟
的时间才能显现画面. 要如何修正呢?

程式如下:

' >

Set rsDirectory = myDB.OpenRecordset("目录名称", dbOpenDynaset)
'
Set nodX = TreeView1.Nodes.Add(, , "0_", "\", 1, 2)
rsDirectory.MoveFirst
'
Do While rsDirectory.EOF = False
With rsDirectory
If !Parent = "0_" Then
Set nodX = TreeView1.Nodes.Add("0_", tvwChild, !Key, !Text, 1, 2)
nodX.EnsureVisible
Else
Set nodX = TreeView1.Nodes.Add(Trim(!Parent), tvwChild, Trim(!Key), Trim(!Text), 1, 2)
End If
.MoveNext
End With
Loop

Follow Ups:

- 不行 小吴 17:35:32 2/22/98 (0)