Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-01

How to select Item from a TComboBox list and compare it

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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;
Kind Regards Eric Kom System Administrator & Programmer - Metropolitan College _________________________________________ / You are scrupulously honest, frank, and \ | straightforward. Therefore you have few | \ friends. / ----------------------------------------- \ \ .--. |o_o | |:_/ | // \ \ (| Kom | ) /'\_ _/`\ \___)=(___/ 2 Hennie Van Till, White River, 1240 Tel: 013 750 2255 | Fax: 013 750 0105 | Cell: 078 879 1334 | www.kom.za.net | www.kom.za.org | www.erickom.co.za Key fingerprint: 513E E91A C243 3020 8735 09BB 2DBC 5AD7 A9DA 1EF5

Reply by email

Sven Barth
to Eric Kom
Eric Kom wrote 15 lines
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

Reply by email

Eric Kom
to Sven Barth
Sven Barth wrote 26 lines
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 ===

Thanks its works,

Show quoted text 9 lines
Regards, Sven -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Kind Regards Eric Kom System Administrator & Programmer - Metropolitan College _________________________________________ / You are scrupulously honest, frank, and \ | straightforward. Therefore you have few | \ friends. / ----------------------------------------- \ \ .--. |o_o | |:_/ | // \ \ (| Kom | ) /'\_ _/`\ \___)=(___/ 2 Hennie Van Till, White River, 1240 Tel: 013 750 2255 | Fax: 013 750 0105 | Cell: 078 879 1334 | www.kom.za.net | www.kom.za.org | www.erickom.co.za Key fingerprint: 513E E91A C243 3020 8735 09BB 2DBC 5AD7 A9DA 1EF5

Reply by email