Hi

do you want these results:

1-John
2-Jane
3-Joe
1-Karl
2-Kermit
3-Kramer
4-Krazy

or these results

1-John
1-Karl
2-Jane
2-Kermit
3-Joe
3-Kramer
4-Krazy


not sure if this helps, but in VB6, you can simply set the ListBox's "Sort"
property to true,
and it will sort for you.  No need to code a sorter.

For numbers, you can simply pad the text with leading zeros, and it will
properly sort them, so
that you dont get:

1
10
100
2
3

of course, you'll need to un-pad the numbers, so you may want to consider
doing the padding behind the scenes prior to displaying the final results.
check if it is faster to do it with another ListBox, then load the visible
listbox, or simply make the ListBox invisible during processing.

fyi, loading a listbox is enormously faster while invisible.

also, consider the ListBox's limited number of entries.  not sure if the
listbox's 25,000 limit has been fixed.  Not sure if 25k was the actual
number, but it was something like that.


--- or ---

make 26 listboxes (or 52 if you want separate lower and upper case
sortings),
and place each letter in a separate listbox, then combine them afterwards.

I know it sounds long-winded, but it may be easier to think object-based.


Hope this helps.

Looking forward to your response.







> I'm writing a custom ListBox usercontrol in vb.net 2002. I am
> randomly adding items and I want them sorted in groups based on the
> first character. Ex: 1-John 2-Jane 3-Joe 1-Kermit. I would want the
> 1's to be together alphabetically and the 2s and 3s and so on. I'm
> trying to avoid having to read each item and put it into a separate
> multi-dimentional array and sort them there, clear the ListBox's
> items and then re-add each array item by item...seems like too much
> work to me :) Thanks for any ideas/help you can think of :)



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to