RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDBComboBox.Items Property

Contains the strings that appear in the list of the database combo box.

Pascal
property Items: TStrings;
C++
__property TStrings Items;

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. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!