listBoxFiles.Items[listBoxFiles.SelectedIndex] = listBoxFiles.Items[listBoxFiles.SelectedIndex];
This is "uh" solution to the problem. I do not recommend it wholesale. It will work well if your ListBox is single selection and not sorted(see below on those). You should also evaluate the alternatives out in google land or wherever you find interesting solutions to annoying problems (back alleys, bingo parlors, or a bottle of alcohol). Plus you may run into some extra fun in the following situations:
Sorted ListBox
- You are not "adding" items to the list box, just changing the array of items. You will need to set Sorted to false then true to trigger a proper sort.
- ...and more... ?
- Your selection will need to be carefully managed. The reassignment of multiple items in the array will likely break your selection state at the conclusion of the rename.
- ...and more... ?
No comments:
Post a Comment