PC Review


Reply
Thread Tools Rate Thread

Array.Copy and Multi-dimensional arrays...

 
 
rmorvay
Guest
Posts: n/a
 
      23rd Dec 2003
I have a requirement to search a multi-dimensional array for an item, then
delete the item and "reset" the array so that their are no gaps in the
resulting array. I have been trying to figure out how to use the Array.Copy
method to accomplish this but it seems to only work for single dimension
arrays. Here is a code sample:

'dim arrTest(600,3) as string 'Actual array dimension needed
dim arrTest(600) as string 'Used only in this test
dim intIndex as Integer
dim randomNum as New Random()

'Get random index into array for delete test
intIndex = random.Next(0, UBound(arrTest))

'Shifts elements from arrTest(intIndex + 1) to arrTest(intIndex)
Array.Copy(arrTest, intIndex + 1, arrTest, intIndex, UBound(arrTest) - 1)

'Clears the last element
arrTest.Clear(arrTest, arrTest.GetUpperBound(0), 1)

Any idea on how to modify this code or let me know a better approach to
doing this for a multidimensional array?

Thanks in advance.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
flatten multi-dimensional array to on-dimensional array per9000 Microsoft C# .NET 8 4th Dec 2006 09:46 AM
array.copy between single/multi dimensional arrays =?Utf-8?B?Y2hhZA==?= Microsoft VB .NET 0 7th Nov 2005 08:45 AM
RE: array.copy between single/multi dimensional arrays =?Utf-8?B?Y2hhZA==?= Microsoft VB .NET 0 7th Nov 2005 07:46 AM
RE: array copy from single-dimensional to multi-dimensional =?Utf-8?B?bWFyaw==?= Microsoft VB .NET 0 30th Jul 2004 11:45 PM
Array.Copy and Multi-dimensional arrays... rmorvay Microsoft VB .NET 4 24th Dec 2003 02:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:32 PM.