Vcl.StdCtrls.TComboBox.Items
Delphi
property Items; { Must be published after OnMeasureItem }
C++
__property Items;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | published | Vcl.StdCtrls.pas Vcl.StdCtrls.hpp |
Vcl.StdCtrls | TComboBox |
Description
Provides access to the list of items (strings) in the list portion of the combo box.
Vcl.StdCtrls.TComboBox.Items inherits from Vcl.StdCtrls.TCustomCombo.Items. All content below this line refers to Vcl.StdCtrls.TCustomCombo.Items.
Provides access to the list of items (strings) in the list portion of the combo box.
Read Items to access the list of items that appears in the combo box. Use the methods of Items to add, insert, delete and move items. Set the value of Items to copy the items from another string list.
For example, for Vcl.DBCtrls.TDBComboBox, use Items to supply the values in the list from which the user can choose. Because Items is an object of type TStrings, you can add, delete, insert, and move items using the Add, Delete, Insert, Exchange, and Move methods of the TStrings object. For example, to add each string to the combo box list, write code such as the following:
while not CountryTbl.Eof do begin DBComboBox1.Items.Add(CountryTbl.FieldByName('Country').AsString); CountryTbl.Next; end;
while (!CountryTbl->Eof) { DBComboBox1->Items->Add(CountryTbl->FieldByName("Country")->AsString); CountryTbl->Next(); }
The ItemIndex property determines which item is selected, if any.
See Also
Code Examples