Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all !
I am listing some text files from my dwg file in Listbox.
I want to do extraction with the code below. But it gives an error about datasource.
error :
"Items collection cannot be modified when the DataSource property is set."
How can I remove an item from the listbox without this error?
int secim = listBox1.SelectedIndex;
if (secim != -1)
{
listBox1.Items.RemoveAt(secim);
// listBox1.DataSource = listBox1.Items;
}
else
{
MessageBox.Show("Seçim Yapın!");
}
Solved! Go to Solution.