Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,895 questions

51,826 answers

573 users

How to use Array.GetLength() method to get number of elements in the specified dimension of an Array in VB.NET

3 Answers

0 votes
Module Module1

    Sub Main()

        Dim arr1D As Array = Array.CreateInstance(GetType(Integer), 7)

        Console.WriteLine(arr1D.GetLength(0))

    End Sub

End Module

' run:
' 
' 7

 



answered Apr 24, 2016 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim arr2D As Array = Array.CreateInstance(GetType(Integer), 6, 3)

        Console.WriteLine("dimension(0) = {0}", arr2D.GetLength(0))
        Console.WriteLine("dimension(1) = {0}", arr2D.GetLength(1))

    End Sub

End Module

' run:
' 
' dimension(0) = 6
' dimension(1) = 3

 



answered Apr 24, 2016 by avibootz
0 votes
Module Module1

    Sub Main()

        Dim arr3D As Array = Array.CreateInstance(GetType(Integer), 6, 4, 3)

        Console.WriteLine("dimension(0) = {0}", arr3D.GetLength(0))
        Console.WriteLine("dimension(1) = {0}", arr3D.GetLength(1))
        Console.WriteLine("dimension(2) = {0}", arr3D.GetLength(2))

    End Sub

End Module

' run:
' 
' dimension(0) = 6
' dimension(1) = 4
' dimension(2) = 3

 



answered Apr 24, 2016 by avibootz
...