[Lazarus] About TComboBox.Items.IndexOfName

Sven Barth pascaldragon at googlemail.com
Thu Oct 31 11:01:00 CET 2013

Am 31.10.2013 10:56, schrieb FreeMan:
> No any  non-ASCII characters,
> 'Admin', 'xxxxx' this to strings added in items
> TmpStr:= 'Admin'
> I := EDT_User.Items.IndexOfName(TmpStr);
> or
> I := EDT_User.Items.IndexOfName('Admin');
> same result
Ah, wait. Now I get your problem. You need to use "IndexOf" instead of 
"IndexOfName". The latter is for cases where the TStrings instance 
contains name-value pairs (like "Foobar=blubb") whereby this will return 
the index of the name-value pair with name "Foobar". For your case you 
need to use "IndexOf" which checks the complete string.


More information about the Lazarus mailing list