谢谢ldhyob的指点,根据提示,已经搞定:
Private Sub ListView2_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
Dim i%
With ListView2
If ColumnHeader.Text = "编号" Then
For i = 1 To .ListItems.Count
.ListItems(i).Text = Format(.ListItems(i).Text, "000000000000")
Next
If .SortOrder = lvwDescending Then
.SortOrder = lvwAscending
Else
.SortOrder = lvwDescending
End If
.Sorted = True
For i = 1 To .ListItems.Count
.ListItems(i).Text = Val(.ListItems(i).Text)
Next i
Else
If (ColumnHeader.Index - 1) = .SortKey Then
.SortOrder = (.SortOrder + 1) Mod 2
Else
.Sorted = False
.SortOrder = 0
.SortKey = ColumnHeader.Index - 1
.Sorted = True
End If
End If
End With
End Sub
[此贴子已经被作者于2006-1-6 16:06:37编辑过] |