How to Reverse Numbers on Visual Basic
- 1). Launch Microsoft Visual Basic Express, then click "New Project..." on the left pane of your screen and select "Console Application." Click "OK" to create a new console project.
- 2). Type the following to create the integer array that will hold numbers 1 to 9:
Dim numArray() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9}
numArray.Reverse(numArray) - 3). Create the following "For...Loop" to display the numbers in reverse order through the console window:
For xCntr = 0 To 8
Console.Write(numArray(xCntr))
Next - 4). Type the following to display a message box when the program is done:
MsgBox("Array numbers reversed.") - 5). Press "F5" to execute the program and reverse the order of the array elements.