* "Wilfredo" <an*******@disc ussions.microso ft.com> scripsit:
I have 25 numbers coming up from 1 to 25, now I want it to
go from 25 to 1 with array.reverse. I get a reverse is not
a member of array.
Sample taken from the MSDN documentation:
\\\
Imports System
Imports Microsoft.Visua lBasic
Public Class SamplesArray
Public Shared Sub Main()
' Creates and initializes a new Array.
Dim myArray As Array = Array.CreateIns tance(GetType(S tring), 9)
myArray.SetValu e("The", 0)
myArray.SetValu e("QUICK", 1)
myArray.SetValu e("BROWN", 2)
myArray.SetValu e("FOX", 3)
myArray.SetValu e("jumped", 4)
myArray.SetValu e("over", 5)
myArray.SetValu e("the", 6)
myArray.SetValu e("lazy", 7)
myArray.SetValu e("dog", 8)
' Displays the values of the Array.
Console.WriteLi ne("The Array initially contains the " _
+ "following values:")
PrintIndexAndVa lues(myArray)
' Reverses the sort of the values of the Array.
Array.Reverse(m yArray, 1, 3)
' Displays the values of the Array.
Console.WriteLi ne("After reversing:")
PrintIndexAndVa lues(myArray)
End Sub
Public Shared Sub PrintIndexAndVa lues(myArray As Array)
Dim i As Integer
For i = myArray.GetLowe rBound(0) To myArray.GetUppe rBound(0)
Console.WriteLi ne(ControlChars .Tab + "[{0}]:" + ControlChars.Ta b _
+ "{1}", i, myArray.GetValu e(i))
Next i
End Sub
End Class
' This code produces the following output.
'
' The Array initially contains the following values:
' [0]: The
' [1]: QUICK
' [2]: BROWN
' [3]: FOX
' [4]: jumped
' [5]: over
' [6]: the
' [7]: lazy
' [8]: dog
' After reversing:
' [0]: The
' [1]: FOX
' [2]: BROWN
' [3]: QUICK
' [4]: jumped
' [5]: over
' [6]: the
' [7]: lazy
' [8]: dog
///
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>