In C#, I have variable, a
, of type string
.
How do I find item
by value of a
in combobox
(I want find item with value no display text of combobox).
In C#, I have variable, a
, of type string
.
How do I find item
by value of a
in combobox
(I want find item with value no display text of combobox).
You can find it by using the following code.
To get the item itself, write:
You should see a method on the combo box control for FindStringExact(), which will search the displaymember and return the index of that item if found. If not found will return -1.
I know my solution is very simple and funny, but before I train I used it. Important: DropDownStyle of combobox must be "DropDownList"!
First in combobox and then:
It works for me right and resolved my problem... But the way (solution) from @st-mnmn is better and fine.
Hi Guys the best way if searching for a text or value is