Gladimir
Regular
I think I am doing something wrong with my listbox control. The Selection Mode is multi-extended and the DataSource is bound to a dataset table resulting from a query.
Everything works wonderfully, until I deselect the last selected item in the Listbox. When I deselect the last selected item in the Listbox, by holding the Control key and clicking the last selected item, the first item in the list becomes selected.
I have code in only one event for this listbox and that is the SelectedIndexChanged event and here is the code:
Everything works wonderfully, until I deselect the last selected item in the Listbox. When I deselect the last selected item in the Listbox, by holding the Control key and clicking the last selected item, the first item in the list becomes selected.
I have code in only one event for this listbox and that is the SelectedIndexChanged event and here is the code:
C#:
private void listMatches_SelectedIndexChanged
(object sender, System.EventArgs e)
{
buttonExclude.Enabled = false;
buttonCommit.Enabled = false;
// update exclude/commit buttons
if (listMatches.SelectedItems.Count > 0)
{
buttonExclude.Enabled = true;
buttonCommit.Enabled = true;
}
labelSelected.Text = listMatches.SelectedItems.Count.ToString();
}
Last edited: