Hi I have this program Im trying to make
but now Im trying to add an option to delete items ( only the selected ones ).
thanx in advance
Hi I have this program Im trying to make
but now Im trying to add an option to delete items ( only the selected ones ).
thanx in advance
To delete the selected items:
while (listBox1.SelectedIndices.Count > 0)
listBox1.Items.RemoveAt(listBox1.SelectedIndices[0]);
protected void Button2_Click(object sender, EventArgs e)
{
for(int i = ListBox1.Items.Count -1; i>=0; i--)
{
if (ListBox1.Items[i].Selected)
{
ListBox1.Items.Remove(ListBox1.Items[i]);
}
}
}
This should work for deleting also