Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear Array 10,10,10 1

Status
Not open for further replies.

Trob70

Programmer
Sep 25, 2012
89
AU
I am converting a vb6 program...in which i am using redim
Which i have found is not in vb.net


dim aaa(10,10,10)

???how to clear all elements in this array in vb.net



array.clear( ???????????


Appreciate you help.. guess its pretty simple...

Trob70
 
All ok i seemed to have worked it out


Dim aaa(10, 10, 10) As String


aaa(2, 2, 2) = "Cat"

ReDim aaa(10, 10, 10)

MsgBox(aaa(2, 2, 2)) 'yes its cleared

Regards Trob70
 
ReDim just makes the copy of your array, and since you did not Preserve (the values in it) you get the empty array.

Look at Array.Clear Method

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Andrzejek

Thanks for your comment

I have looked at the link

ie Array.Clear(timeZoneTimes, 1, 1)

??in a 3 dimensional array ie aaa(10, 10, 10) how do you use this code ??? Array.Clear(aaa, 1, 1) does not seem to work

Regards Trob70

 
Check out this MSDN link for an explanation of the Array.Clear method:


Look at the bottom of the first example, where it says "' The example displays the following output:", and you can see how the Array.Clear method works. In your case, since you want to clear the entire array, you would do this:

Array.Clear(aaa, 0, aaa.Length)


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
jebenson

Thanks for your help

Regards Trob70
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top