ReDim: Make the array larger

Imports System
Public Class MainClass
Shared Sub Main()
'Declare an array
Dim strFriends(4) As String
'Populate the array
strFriends(0) = "R"
strFriends(1) = "B"
strFriends(2) = "S"
strFriends(3) = "S"
strFriends(4) = "K"
ReDim Preserve strFriends(6)
strFriends(5) = "M"
strFriends(6) = "J"
For Each strName As String In strFriends
System.Console.WriteLine(strName)
Next
End Sub
End Class
Related examples in the same category