Setting the selected item of a listbox when only one the text value

C

ChunkyMonkey

Hi,

As simple as I am sure this is, I am not able to get something the work.

I have a text value (string), and I want to find an item in a listbox where
the item matches the string I have, and then set that item as the selected
item.

How is this done ?


Thanks!!
 
R

roidy

Dim item As Integer = ListBox1.FindString(string)
ListBox1.SelectedIndex = item

where 'string' is the string you want to find.

Rob
 
R

roidy

Dim item As Integer = ListBox1.FindString(string)
ListBox1.SelectedIndex = item

where 'string' is the string you want to find.

Rob
 

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

Top