Reputation: 2299
I am trying to edit the last item in a listbox without having it selected. Because I can't select items in the list (this is my default for my application). It's a Windows Form Application.
Normally I would do something like: listBox1.SelectedIndex = listBox1.Items[listBox1.SelectedIndex] + " -> This string is added"
but because I can't select anything, this won't work.
Can someone help me out here?
Upvotes: 3
Views: 1144
Reputation: 236208
You can get last item from Items
collection by index:
listBox1.Items[listBox1.Items.Count - 1] + " -> This string is added";
Upvotes: 1