954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Referencing a single dimension of a multi-dimensional array

I've got a situation where I have an array declared:

Dim limit(255, 31) As Integer
    ...
    DecodeTable(limit(index), ... )


Later in my code, I have to pass the second rank by reference to a sub. This would be simple in a C-based language:

int limit[255][31];
    ...
    DecodeTable( limit[ index ], ... );

Not sure how many people understand that, but basically what I have to do is pass the second rank to the sub by reference. By referencing

limit(index)


the compiler throws an exception because I'm using fewer indices than the array was declared to have. Does anyone know how to do this with VB.NET?

cypher
Newbie Poster
17 posts since Jul 2004
Reputation Points: 14
Solved Threads: 0
 

I think I've found my answer. It appears that you can declare arrays in VB.NET the same as you can in C-based languages (jagged-style)

Dim limit(255, 31) As Integer

can also be declared as

Dim limit(255)(31) As Integer

and so referencing only

limit(index)

is legal :)

Appreciate your interest anyway.

cypher
Newbie Poster
17 posts since Jul 2004
Reputation Points: 14
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You