CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 1999
    Location
    Sweden
    Posts
    33

    How many elements in an array

    Hi!
    I have a function that takes an array of integers as argument. This is a dynamic array so I don´t know how may elements in this array.
    How do I find that out?
    Thanks in advance
    Jen


  2. #2
    Join Date
    Apr 1999
    Location
    Netherlands
    Posts
    181

    Re: How many elements in an array

    Use LBound to get the lower bound of the array (usually 0 or 1) and UBound to get the upperbound (last entry) of the array.

    Crazy D @ Work :-)

  3. #3
    Join Date
    Oct 1999
    Posts
    16

    Re: How many elements in an array

    You could use the LBound and the Ubound functions to return the lower/upper bounds of the array
    for eg.,
    dim aryNames(10)

    MsgBox LBound(aryNames)
    MsgBox UBound(aryNames)




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured