Listbox, array, item deletion

  • Thread starter Thread starter Sweetiecakes
  • Start date Start date
S

Sweetiecakes

Hi

I have an string[] array containing file paths. I have added them to a
ListBox with AddRange();

When I delete an item from the ListBox, how can I delete the same item
from the original array?

Thanks
 
It's not possible. All you can do is to create an new array(leaving the
deleted string) and assign it to the same old array variable/field.
 
I have an string[] array containing file paths. I have added them to a
ListBox with AddRange();

When I delete an item from the ListBox, how can I delete the same item
from the original array?

Like Ashutosh said, there's no way to delete an arbitrary element from an
array. Next time consider using a List<string> instead and it will handle
removing items for you.
 
Back
Top