Sorting Arrays ...

I have an array of variables with integer values, but some times they don't sort correctly. I continue to call upon the sort operation, but it sorts the string wrong every time, until I change the variables again.

Dim Ranger()AsString = {var0, var1, var2, var3, var4, var5, var6, var7, var8, var9}
Array.Sort(Ranger)
Rangebox.Text ="" & Ranger(0) &" to " & Ranger(9) &""

Maybe there a problem, where if 3 of the variables have the same value, it causes it to sort weird?

[965 byte] By [Modderman] at [2007-12-16]
# 1
If the standard sort doesn't work for you, you have to use a iCompare class.

see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemarrayclasssorttopic3.asp for more details.

Dustin_H at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 2
You aren't sorting an array of integer values, but rather an array of String values.

Strings values sort differently to integers. For example:

Given the following numbers, 1, 5, 10, 11

Sorting as a string would give the following orrder: 1, 10, 11, 5,
Sorting as a integer would give the following order: 1, 5, 10, 11

DavidM.Kean at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 3
Why does it sort as a string sometimes and sort as integers other times?
Modderman at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...
# 4
Because above in your code sample, you have declared am array of strings, not integers.
DavidM.Kean at 2007-9-9 > top of Msdn Tech,Visual Basic,Visual Basic General...