How do you remove an individual item from a listbox?

Recommended Answers

All 2 Replies

int position = ListBox1.SelectedIndex;
    if(position >= 0)
    {
        ListBox1.Items.RemoveAt(position);
    }
    else
    {
        //output message asking the user to select an item from the list
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.