User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 425,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,595 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 15207 | Replies: 1
Reply
Join Date: Jul 2004
Posts: 17
Reputation: cypher is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
cypher cypher is offline Offline
Newbie Poster

Referencing a single dimension of a multi-dimensional array

  #1  
Jul 15th, 2004
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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2004
Posts: 17
Reputation: cypher is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
cypher cypher is offline Offline
Newbie Poster

Re: Referencing a single dimension of a multi-dimensional array

  #2  
Jul 15th, 2004
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 9:20 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC