ReDim an array : ReDim « Collections « VB.Net Tutorial






Module Module1

    Sub Main()
        Dim Scores() As Integer
        ReDim Scores(1)
        Scores(0) = 25
        Scores(1) = 75
        ReDim Preserve Scores(5)
        Scores(2) = 95
        Scores(3) = 35
        Scores(4) = 65
        Scores(5) = 85
        Console.WriteLine("Scores(3) = " & Scores(3))
    End Sub

End Module
Scores(3) = 35








8.8.ReDim
8.8.1.ReDim an array
8.8.2.Redim Preserve array
8.8.3.ReDim string array length
8.8.4.Dynamic array
8.8.5.Dimension the array at runtime
8.8.6.Redimension the array and preserve its element values
8.8.7.Use ReDim Preserve to add elements to an array