|
-
Mar 16th, 2000, 03:13 AM
#1
Thread Starter
Addicted Member
As you know, sort property for Combobox is ready only and sorted in Ascending order. For my dynamically filled combobox(not sorted), if I want a descending order list, what Can I do?
May I use API sendmessage call? I just visited web site "VB API" listed on your left screen but found nothing specially helpful. Any suggestion? In a situation like this, any internet resource I can use to find the answer by myself? You see, I am asking more than just answer here. Thanks
-
Mar 16th, 2000, 04:02 AM
#2
Hyperactive Member
I don't think there's an API call that deals specifically with sorting a combo or listbox in descending order. However, you can develope a code yourself. Note: If you want to add a large amount of items and sort them, it make take some time to sort out, but if you want to have a combo/listbox that is never changed to be sorted, then sort it by hand. If you want to be able to add items one at a time, a code to place this item in the right place shouldn't take to long.
Your code could be something like this for adding one item to the correct ascending order at a time (I think):
Code:
Dim i as Single, j as Single
For i = 0 to List1.Listcount - 1
For j = 1 to Len(Text1)
If Left(Text1, j) = Left(List1.List(i), j) Then
If Left(Text1, j + 1) <> Left(List1.List(i), j + 1) Then
List1.AddItem Text1, i + 1
Exit Sub
End If
Else
Exit For
End If
Next
Next
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
|