Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

How to: Sort An Array in Visual Basic

This example declares an array of String objects named zooAnimals, populates it, and then sorts it alphabetically.

Private Sub sortAnimals()
    Dim zooAnimals(2) As String
    zooAnimals(0) = "lion"
    zooAnimals(1) = "turtle"
    zooAnimals(2) = "ostrich"
    Array.Sort(zooAnimals)
End Sub

This example requires:

  • Access to Mscorlib.dll and the System namespace.

The following conditions may cause an exception:

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.