ReDim: Make the array larger : Array ReDim « Data Structure « VB.Net

ReDim: Make the array larger

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

    End Sub
End Class


Related examples in the same category

1.ReDim an Array: new ArrayReDim an Array: new Array
2.Changes the number of elements of an array to the specified new size.