Search In ListBox

  • Thread starter Thread starter shachar
  • Start date Start date
S

shachar

hi all.
any one know a standard/free ListBox Control for vb.net
that can be searched in, even in 'multiSelect' state?
thanks.
 
Shachar,

The listview in detail mode with one column comes in my opinion very near to
what you ask.

Cor

next
 
shachar said:
any one know a standard/free ListBox Control for vb.net
that can be searched in, even in 'multiSelect' state?

Take a look at the listbox's 'FindString' and 'FindStringExact' methods.
 
Shachar,

I am always strugling finding that multiselect settig of a listbox, I knew
it again, this can be the code with a listbox.

\\\
ListBox1.SelectionMode = SelectionMode.MultiExtended

For i As Integer = 0 To ListBox1.Items.Count - 1
ListBox1.SetSelected(i, False)
If ListBox1.Items(i).ToString.IndexOf("a") <> -1 Then
'"a" is any searchitem
ListBox1.SetSelected(i, True)
End If
Next
///

I hope this helps?

Cor
 
Cor Ligthert said:
For multiselect?

AFAIK does that find the first.

ACK, but you can specify the index where the search should start. You can
use the index of the last element that was found using 'FindString' + 1 as
start index for the next call to 'FindString'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top