|
-
Nov 22nd, 2000, 09:55 AM
#1
Thread Starter
New Member
Hi,
How to sort a listbox witout code?
Is exists a method for that?
Thanks
-
Nov 22nd, 2000, 10:17 AM
#2
You can change the Sorted property to True in design time.
-
Nov 22nd, 2000, 12:14 PM
#3
_______
<?>
Code:
'unfortunately it won't sort numerics properly
'
'example being.
Private Sub Form_Load()
List1.AddItem 5
List1.AddItem 5001
List1.AddItem 50
List1.AddItem 111
List1.AddItem 11
List1.AddItem 10001
List1.AddItem 333
List1.AddItem 11101
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 22nd, 2000, 12:26 PM
#4
Not a problem:
Code:
Public Sub SortListNumberic(p_List As ListBox)
Dim i
Dim j
Dim lngTemp As Long
For i = p_List.ListCount - 1 To 0 Step -1
For j = 1 To i
If Val(p_List.List(j - 1)) > Val(p_List.List(j)) Then
lngTemp = p_List.List(j - 1)
p_List.List(j - 1) = p_List.List(j)
p_List.List(j) = lngTemp
End If
Next
Next
End Sub
Private Sub Command2_Click()
Call SortListNumberic(List1)
End Sub
Private Sub Form_Load()
List1.AddItem 5
List1.AddItem 5001
List1.AddItem 50
List1.AddItem 111
List1.AddItem 11
List1.AddItem 10001
List1.AddItem 333
List1.AddItem 11101
End Sub
-
Nov 22nd, 2000, 12:28 PM
#5
Thread Starter
New Member
THANKS FOR YOUR HELP!!!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|