Ghi
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Quyền truy cập vào trang này yêu cầu sự cho phép. Bạn có thể thử thay đổi thư mục.
This article shows an example of how to sort an array of strings in Visual Basic.
Example
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
Robust programming
The following conditions may cause an exception:
- Array is empty (ArgumentNullException class).
- Array is multidimensional (RankException class).
- One or more elements of the array don't implement the IComparable interface (InvalidOperationException class).
See also
Cộng tác với chúng tôi trên GitHub
Bạn có thể tìm thấy nguồn cho nội dung này trên GitHub, nơi bạn cũng có thể tạo và xem xét các vấn đề cũng như yêu cầu kéo. Để biết thêm thông tin, hãy xem hướng dẫn cộng tác viên của chúng tôi.