Results 1 to 3 of 3

Thread: Delete Selected Arraylist Item

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    10

    Delete Selected Arraylist Item

    Hi all, I would like to know how do I do the code if I wanna delete a selected item from the array list and not all the items store in the array list? My code is,
    vb.net Code:
    1. Dim PageObject As pageItem
    2.         PageObject = New pageItem("Page" + pnumber.ToString)
    3.         PageObject.itemFile = OpenFileDialog1.FileName
    4.         PageObject.videos = New ArrayList
    5.         PageObject.podcasts = New ArrayList
    6.         PageObject.photos = New ArrayList
    7.         PageArray.Add(PageObject)
    Thanks!

  2. #2
    Hyperactive Member
    Join Date
    Apr 2011
    Location
    England
    Posts
    421

    Re: Delete Selected Arraylist Item

    I don't get the Code Snippet but typically to remove an item from an arraylist you would use either:

    ArrayList.Remove(Item)
    ArrayList.RemoveAt(ItemIndex)

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Delete Selected Arraylist Item

    ArrayList has been almost entirely replaced by List (of T), and should only be used if you have no alternative. However, you would still just call the Remove or RemoveAt methods, either way.
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width