Software Development Network>> VS Team System>> Removing or editing items in a listbox
you can also use this to remove the item:
if (this.theListBox.SelectedIndex > -1)
{
this.theListBox.Items.Remove(this.theListBox.SelectedIndex);
}
to edit, try....
this.theListBox.Items[this.theListBox.SelectedIndex] = "new value";
How about this:
string itemToEdit = (string)listBox1.SelectedItem; //change the item here itemToEdit = itemToEdit + "xx"; //for example listBox1.Items[listBox1.SelectedIndex ] = itemToEdit;
string
itemToEdit = itemToEdit +
listBox1.Items[listBox1.SelectedIndex ] = itemToEdit;
Try this:
listBox1.Items.Remove(listBox1.SelectedItem);
Removing or editing items in a listbox
Aaron Sulwer
you can also use this to remove the item:
if (this.theListBox.SelectedIndex > -1)
{
this.theListBox.Items.Remove(this.theListBox.SelectedIndex);
}
to edit, try....
if (this.theListBox.SelectedIndex > -1)
{
this.theListBox.Items[this.theListBox.SelectedIndex] = "new value";
}
gr8mind
How about this:
TaYeB
HsiaoI
Try this: