Home > Back-end >  How to find text in the ListBox or ComboBox control?
How to find text in the ListBox or ComboBox control?

Time:09-29

ListBox basic will use, I want to quickly locate in ListBox to a line of text to do?

CodePudding user response:

ListBox Items and ComboBox Items are a TStrings object, a method IndexOf can according to the string corresponding to the row index, such as:
 int nIndex=ListBox - & gt; The Items - & gt; IndexOf (" 333 "); 
ShowMessage (nIndex & gt; - 1? String (nIndex) : String (" not found "));

Or
 int nIndex=ComboBox - & gt; The Items - & gt; IndexOf (" 333 "); 
ShowMessage (nIndex & gt; - 1? String (nIndex) : String (" not found "));

CodePudding user response:

 
ListBox - & gt; The Items - & gt; IndexOf
  • Related