VBScript - Sort question

Gearhead7

Member
Joined
Jul 17, 2006
Messages
10
Programming Experience
Beginner
I could not find a forum specifically for VBScripting. Can you use a Array.Sort method in VBScript or do you have to build a manual system for sorting? If so, where the heck would I start? :confused: Thanks in advance.
 
Ok althrough VBScript is not targeted language of this forum again it is a little bro of the vb as well of VB.NET :D
means to sort an array of values, nothing special needs to be done:
For example, say you have an array like this one:
VB.NET:
dim myArray
myArray = Array(3,1,8,2,4)
Then in order to sort this array you should do this:
VB.NET:
dim sort
set sort = new QSort
sort.Sort myArray

if you want to output the array you can do something like this:

VB.NET:
dim i
for i = 0 to UBound(myArray)
   if (i > 0) then Response.Write ","
   Response.Write myArray(i)
next
and the output will look like this:
VB.NET:
1,2,3,4,8

HTH
Regards ;)
 
Kulrom, thanks for the info. I'll use this to make a sort that works right. It makes alot more sense when someone can explain it to you. :)
 
Back
Top