[Lazarus] How to select Item from a TComboBox list and compare it

Sven Barth pascaldragon at googlemail.com
Thu Jan 10 17:49:07 CET 2013


Am 10.01.2013 17:11, schrieb Eric Kom:
> Good day,
>
> I wrote a procedure DisplayFeesList, please how can I read an Item 
> from a TComboBox type list and then compare it to a string.
>
>
> procedure DisplayFeesList(Sender: TObject);
> begin
>      if  cbbBoarderType.Items.Text='Yes'  then begin
>       cbbFeesList.Clear;
>       cbbFeesList.Enabled:=True;
>       cbbFeesList.AddItem(32500, 35000);
>    end;
> end;
>
You mean the currently selected item? This works as follows:

=== source begin ===

if cbbBoarderType.Items[cbbBoarderType.ItemIndex] = 'Yes' then begin
   // ...
end;

=== source end ===

Regards,
Sven




More information about the Lazarus mailing list