I'm having a ComboBox in which I added items in order provide the user autocomplete for the text he's typing. I am looking for a property of ComboBoxes that could identify if the text was an item of the ComboBox or not. (I would like not to loop each time through its items).

I would like do use ComboBox.Text if the item does not exist and ComboBox.SelectedItem if it does.

Thanks.

Have you tried ComboBox.FindString() ?

What do you mean exactly when you say 'if the thext was an item' what else could it be in your case?

Wouldn't the Text property always contain the value they want? If they selected one from the list, it would be displayed in the Combobox input area (the Text property). If they typed it in, again it's in the Text property.

reply to Momerath: Indeed, the Text property contains the value in either of the cases, as I observed after posting the article.

reply to castajiz_2: In the combobox text area the user can type one of the items(the autocomplete comes in handy) or something else(Eg.: Let's say it contains names. The user is trying to introduce a name. It could be already listed or it could be something different).

reply to Ancient Dragon: I think that's what I was looking for. Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.