listbox question
-
In my Windows Forms application I have a listbox on the form. This is a multiple selection list box. I can use SelectedIndices property to get the indices of all the selected items. However, given an index number, is there a simple way to tell if the item is selected or not? Right now I search the SelectedIndices to see if the index is there. I wonder if there is a method call to tell me directly if an item is selected or not. I tried to find that but couldn't. Thanks!
-
In my Windows Forms application I have a listbox on the form. This is a multiple selection list box. I can use SelectedIndices property to get the indices of all the selected items. However, given an index number, is there a simple way to tell if the item is selected or not? Right now I search the SelectedIndices to see if the index is there. I wonder if there is a method call to tell me directly if an item is selected or not. I tried to find that but couldn't. Thanks!
Hi, you could try
listBox.Items.Contains(...)
:)Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
-
Hi, you could try
listBox.Items.Contains(...)
:)Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
That works. Thanks!
-
Hi, you could try
listBox.Items.Contains(...)
:)Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
-
That works. Thanks!