Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Mar 2nd, 2005, 2:49 PM   #1
ChefBoiAreDee
Newbie
 
Join Date: Mar 2005
Posts: 5
Rep Power: 0 ChefBoiAreDee is on a distinguished road
For Each ... Next, Nested Array issues.

I am trying to perform a For Each Loop on a nested array and VB is yelling at me

The nested array structure is this.
MainArray(0)
    SubArray(0) = "Some String"
    SubArray(1) = "Some String"
    SubArray(2) = "Some String"
MainArray(1)
    SubArray(0) = "Some String"
    SubArray(1) = "Some String"
    SubArray(2) = "Some String"
...and so on.

Where SubArray always contains 3 total elements and MainArray can have any number of elements which are SubArray.

Here is what I have.
Private Sub ProcessArray(byref MainArray as Variant)

    For Each SubArray In MainArrary
        DoSomething SubArray(0), SubArray(1), SubArray(2)
    Next

End Sub
Upon attempting to compile I get this error.

For Each control variable must be Variant or Object

I've tried to declare SubArray before the loop like this.
Dim SubArray(2) as Variant
and even like this.
Dim SubArray() as Variant
But I can't get anything to work

Can this just not be done in VB?

Thanks in advance to anyone who posts.
ChefBoiAreDee is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:47 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC