question about Array two dimension

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meromake
    New Member
    • Jun 2007
    • 9

    #1

    question about Array two dimension

    Code:
    Dim Arr(1,2) As String
    Dim I as Integer 
    I = Arr.Length
    I = 6
    No, I wanna know

    Length that = 2
    Width that= 3
  • GayathriP
    New Member
    • Oct 2007
    • 17

    #2
    To find the dimensions's length individually you need to use the GetLength method.

    Sample Code is

    Code:
    //C# Code
    string[,] arrstr = new string[2, 3];
    
    MessageBox.Show(arrstr.GetLength(0).ToString());  ---> displays 2
    MessageBox.Show(arrstr.GetLength(1).ToString());  ---> displays 3

    Comment

    Working...