I am having an issue with a combo box. I have a list of strings set from a lookup table, and i set the combobox's selectedtext at runtime. the problem is, that the box dispays the selectedtext concatenated with the first item in the list. any ideas????
i am pulling data from my dataset, and setting the combobox to that, but i guess i could always setup a switch, just seems like there would be an easier way.
i've tried indexOf, and i cannot get it to take the string, it keeps returning nothing in the combobox. am i using the command correctly? indexOf(string)? what is the argument?
It's because the combobox will not contain string objects when bound to a dataset. It will contain DataRowViews. Therefore, you must not be using the DropDownList style. You must be using the type of ComboBox that allows users to type what they want in the box--even if it is not in the list.
I'm sure there may be easier ways, but try this:
Code:
For Each drv As DataRowView In ComboBox.Items
If drv.Item(0) = "Your value you need" Then
ComboBox.SelectedItem = drv
Exit For
End If
Next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.