2 Replies - 3129 Views - Last Post: 08 April 2010 - 04:22 PM Rate Topic: -----

#1 AmuletOfNight   User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 153
  • Joined: 23-July 09

Removing parts of an array

Posted 08 April 2010 - 02:39 PM

I seem to have a problem here. I need to be able to delete a certain part of an array. For example, this is the array

Array(0) = "Test"
Array(1) = "Test2"
Array(2) = "Test3"


And I need to remove Array(1) so that it reads

Array(0) = "Test"
Array(1) = "Test3"


I have no idea how to go about his. I have the adding code, which is

        'Count the statuses and apply them to current amount
        CurrentAmount = StatusTexts.Count
        'Using ReDim with PRESERVE to preserve array contents to avoid deletion bug
        ReDim Preserve StatusTexts(CurrentAmount)
        ReDim Preserve StatusDelays(CurrentAmount)
        StatusTexts(CurrentAmount) = "Extra Status"
        StatusDelays(CurrentAmount) = 100
        StatusesCB.Items.Add("Extra Status")
        StatusesCB.SelectedIndex = CurrentAmount


How may I do this? Thank you!

Is This A Good Question/Topic? 0
  • +

Replies To: Removing parts of an array

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14093
  • View blog
  • Posts: 56,466
  • Joined: 12-June 08

Re: Removing parts of an array

Posted 08 April 2010 - 02:41 PM

Arrays (in .NET) are fixed size, right? The only way to remove that would be to create a new array of the new size.. copy everything over one to one except the one you want removed.... or just use a linked list.
Was This Post Helpful? 0
  • +
  • -

#3 AdamSpeight2008   User is offline

  • MrCupOfT
  • member icon

Reputation: 2298
  • View blog
  • Posts: 9,535
  • Joined: 29-May 08

Re: Removing parts of an array

Posted 08 April 2010 - 04:22 PM

One of the Generic Collections, say List(Of String)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1