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:
Dim PageObject As pageItem
PageObject = New pageItem("Page" + pnumber.ToString)
PageObject.itemFile = OpenFileDialog1.FileName
PageObject.videos = New ArrayList
PageObject.podcasts = New ArrayList
PageObject.photos = New ArrayList
PageArray.Add(PageObject)
Thanks!
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)
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.