Software Development Network>> VS Team System>> Removing or editing items in a listbox
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);
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";
Removing or editing items in a listbox
Ganeshkumar S
How about this:
AlexBB
ThePope78705
Try this:
Veebs
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";
}