Get array lower bound, upper bound and length : Array Bound « Collections « VB.Net Tutorial






Module Tester

    Sub Main()
        Dim Values() As Integer = {100, 200, 300, 400, 500}
        Dim MyValues(5) As Integer
        Dim Prices() As Double = {25.5, 4.95, 33.4}

        Dim I As Integer

        For I = 0 To 4
            Console.Write(Values(I) & " ")
        Next
        Console.WriteLine()

        Console.WriteLine("Array length: " & Values.Length)
        Console.WriteLine("Array lowerbound: " & Values.GetLowerBound(0))
        Console.WriteLine("Array upperbound: " & Values.GetUpperBound(0))
    End Sub

End Module
100 200 300 400 500
Array length: 5
Array lowerbound: 0
Array upperbound: 4








8.2.Array Bound
8.2.1.Show and use the array boundaries
8.2.2.Use array UBound in For loop
8.2.3.GetUpperBound
8.2.4.Array lower bound and upper bound
8.2.5.Get array lower bound, upper bound and length