Highlight Item in ListBox

  • Thread starter Thread starter Beebs
  • Start date Start date
B

Beebs

Quick question...how do I iterate through the items of a listbox and
highlight the item that matches a text string I'm searching for?
 
Beebs said:
Quick question...how do I iterate through the items of a listbox and
highlight the item that matches a text string I'm searching for?

I would write something like this:

for(int i = 0; i < listBox1.Items; i++)
{
if(textSearchedFor == listBox1.Items.ToString())
listBox1.SelectedIndex = i;
}


Sincerly
Linus
 
Back
Top