With tvw .LineStyle = tvwTreeLines .Scroll = True .SingleSel = True .Style = tvwTreelinesPlusMinusPictureText .Sorted = True End With Dim o As Object
With tvw Set o = .Nodes.Add(, tvwFirst, "a", "根节点") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aa", "1") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aaa", "3") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aaaa", "2") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aaaaa", "4") o.Sorted = True End With 你试试这个看看'那个网页Service Unavailable
我用的是:Microsoft Treeview Control, version 6.0我们说的是同一个控件不?是同一个版本不?
private sub Init_Form_Load With tvw .LineStyle = tvwTreeLines .Scroll = True .SingleSel = True .Style = tvwTreelinesPlusMinusPictureText .Sorted = True End With end sub private ubInit_Ctrl() Dim o As Object
With tvw Set o = .Nodes.Add(, tvwFirst, "a", "根节点") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aa", "1") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aaa", "3") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aaaa", "2") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aaaaa", "4") o.Sorted = True End With set o = nothing end sub我刚才那会写的代码
你这样sort相当于没sort With tvw Set o = .Nodes.Add(, tvwFirst, "a", "根节点") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "ba", "1") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "baa", "3") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "baaa", "2") o.Sorted = True Set o = .Nodes.Add("a", tvwChild, "aaaaa", "4") o.Sorted = True End With这样“aaaaa”还在最后么?
Relationship:=tvwChild, Text:=MakeNodeText(strNewName, 0, 0), Image:=2)就多用了text参数。你呢?
With tvw
.LineStyle = tvwTreeLines
.Scroll = True
.SingleSel = True
.Style = tvwTreelinesPlusMinusPictureText
.Sorted = True
End With
Dim o As Object
With tvw
Set o = .Nodes.Add(, tvwFirst, "a", "根节点")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aa", "1")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aaa", "3")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aaaa", "2")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aaaaa", "4")
o.Sorted = True
End With
你试试这个看看'那个网页Service Unavailable
private sub Init_Form_Load
With tvw
.LineStyle = tvwTreeLines
.Scroll = True
.SingleSel = True
.Style = tvwTreelinesPlusMinusPictureText
.Sorted = True
End With
end sub
private ubInit_Ctrl()
Dim o As Object
With tvw
Set o = .Nodes.Add(, tvwFirst, "a", "根节点")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aa", "1")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aaa", "3")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aaaa", "2")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aaaaa", "4")
o.Sorted = True
End With
set o = nothing
end sub我刚才那会写的代码
Set o = .Nodes.Add(, tvwFirst, "a", "根节点")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "ba", "1")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "baa", "3")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "baaa", "2")
o.Sorted = True
Set o = .Nodes.Add("a", tvwChild, "aaaaa", "4")
o.Sorted = True
End With这样“aaaaa”还在最后么?
.你的代码在我这里出来的结果是按字母序的