|
-
Apr 29th, 2002, 08:10 AM
#1
Comparing Numbers
I am trying to compare a list of numbers in a list box and determine which are the highest or lowest. For example given a list of 50 numbers which are the lowest 25 numbers in the list. Does anyone have any idea on how to do this?
-
Apr 29th, 2002, 08:16 AM
#2
Format the numbers using the Format() function so that they all have the same nuumber of digits (left pad with leading zeroes).
Use the Sorted property of the ListBox to display the entries in order.
Retrieve the top or bottom 25 items from your list.
Tris.
This world is not my home. I'm just passing through.
-
Apr 29th, 2002, 08:16 AM
#3
Bouncy Member
since you can set a listboxs sorted property to True, (this will sort the list), then just select to top/bottom 25 etc
-
Apr 29th, 2002, 08:16 AM
#4
Ah, just had a thought...
Do you have duplicate numbers in your list?
Tris.
This world is not my home. I'm just passing through.
-
Apr 29th, 2002, 08:20 AM
#5
Bouncy Member
good point about the padding, forgot that 
that or you could stick em in an array and bubble sort them etc
-
Apr 29th, 2002, 08:22 AM
#6
yes there could possibly be duplicate numbers in the list
-
Apr 29th, 2002, 08:23 AM
#7
If you have duplicate numbers you will have to do what Darre1 and I already suggested, but instead of taking the first/last 25 entries you will need to code this.
Code:
count = 1
a = first entry
results( count ) = a
while count < 25 do
a = next entry
if a <> results( count ) then
count = count + 1
results( count ) = a
endif
end while
This world is not my home. I'm just passing through.
-
Apr 29th, 2002, 08:26 AM
#8
you guys are awesome I appreciate the help
-
Apr 29th, 2002, 08:33 AM
#9
Bouncy Member
Originally posted by cmaroun2533
you guys are awesome I appreciate the help
trisglow and i will now go back to saving small worlds and stuff
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
|