How to sort numbers in a Listbox in desending order using an array and bubblesort
Posted on 2004-10-04
I want to make a program that will sort the users inputed numbers in a desending order. On my form I have a listbox ,a texrbox and two cmdButtons.
The user enters a several numbers (anywhere from a value of 1 to a million or so) example: 2; 25; 1,794; 4,009,546 etc. They then click one of the cmdButtons and this number is added to the listbox and I am guessing to an array. Once the user has entered all the numbers they need sorted., they click the other cmdButton and the numbers in the listbox are sorted. I am not familiar with sorting(bubble, quick) or arrays (how to populate them in real time)so any code on how to accomplish this would be greatly appreciated. Also I guess I would need a third button to clear listbox and the array (ReDim?) so the user could enter a new set of numbers to be sorted from least to greatest.