Visual Basic Reverse Array

In the Visual Basic programming language, we use the Array.Reverse() function to reverse the array, or in other words, to sort the elements in reverse order.

In the example code below, first the correct order of the array and then the reverse order are printed on the screen.

Module ModuleTest Sub Main() Dim arr As String() = {"Ali", "Jack", "Joe", "Jennifer", "Mick"} For Each value As String In arr Console.WriteLine(value) Next Console.WriteLine() Console.WriteLine("Print Reverse") Console.WriteLine() Array.Reverse(arr) For Each value As String In arr Console.WriteLine(value) Next Console.WriteLine() Console.ReadLine() End Sub End Module


You May Interest

How to Find the Name of the Operating System in Visual Basic ?

Visual Basic Finding the Operating System Username

Visual Basic String Making Lowercase

Visual Basic Adding Elements to List

Visual Basic Substring Method