Results 1 to 12 of 12

Thread: Using an array like a variable

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98

    Using an array like a variable

    Is it possible to pull something out of only one spot of a dimensional array?

  2. #2
    Lively Member neodatatype's Avatar
    Join Date
    Aug 2002
    Location
    Italy
    Posts
    103

    Re: Using an array like a variable

    Is it possible to pull something out of only one spot of a dimensional array?
    I don't understand the question.

    Maybe you are searching for the Array.CopyTo() method.

    Bye!
    > NeoDataType.net <

    Try my Free .Net Reporting Tool!

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98
    Say my array is this:

    0|0
    1|1
    2|2
    3|3

    How can i get just the bolded strings?

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    ?
    VB Code:
    1. dim item as object=myarray(0)

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98
    Thats how you get the first one, right?

  6. #6
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by Azkar
    Thats how you get the first one, right?
    Use variables, let it on the fly pick which 1 you want, then use MyArray(N)

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes that will retrieve the first element in a zero based array (all arrays are by default zero based).

    To retrieve the next one:
    VB Code:
    1. MessageBox.Show(myarray(1).ToString)

  8. #8

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98
    AHHHH i got it, thanks

  9. #9

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Posts
    98
    Hmmm, i cant have a 4 dimintional array?

  10. #10
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Four dimentional array :
    VB Code:
    1. Dim ary(3,3) As String

  11. #11
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261
    Originally posted by Pirate
    Four dimentional array :
    VB Code:
    1. Dim ary(3,3) As String
    Umm, that would be a 2 dimensional array!

    Unless I'm wrong, here's how it is:

    Dim Ary(1) As String - 1 dimensional (imagine each element as a point on a line)
    Dim Ary(2,3) As String - 2 dimensional (imagine each element as a point on a square grid)
    Dim Ary(4,5,6) As String - 3 dimensional (imagine each element as a point on a 3D cube grid)
    Dim Ary(7,8,9,10) As String - 4 dimensional (a point on a cube grid at a specific time?)

    The number of dimensions an array contains has nothing to do with the number of elements each dimension contains.
    Last edited by Hu Flung Dung; Aug 18th, 2003 at 10:26 PM.

  12. #12
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Oops .

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