Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort Arrays in an ascending order

Status
Not open for further replies.

hallian92

Programmer
Jul 30, 2002
8
US
Hi,
Can anyone tell me how to sort an Array of integers in an ascending order. I have an array of integers and I want to sort them in an ascending order in the same array. Is there any built-in function that does that in vb 6.0. I really appreciate for any help.
Thanks
 
Just off hand, visit sites like for various little things like sorting.

Doing a search for "visual basic sort routines" at just about any search engine will return you a number of different options.

--
Jonathan
 
Look into the 'bubble sort'. It is a basic sorting routine included in almost every text book. It is not the fastest but will do fine for a small array of integers. Thanks and Good Luck!

zemp
 
You can always dump the array to a listbox whose sort property is set to true then read the data back in

''''Clear The Listbox
list1.Clear

''''read Data to Listbox
For i = 0 to(ubound(array)-1)
list1.additem Array(i)
next i

''''clear Array. Not necessary but I prefer a clean array
erase array

''''Load Array
for i = 0 to (list1.listcount-1)
array(i) = list1.list(i)
next i
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top