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
