Vcl.DBCtrls.TDBListBox.Items

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Items: TStrings read FItems write SetItems;

C++

__property Items = {write=SetItems};

Properties

Type Visibility Source Unit Parent
property published
Vcl.DBCtrls.pas
Vcl.DBCtrls.hpp
Vcl.DBCtrls TDBListBox

Description

Contains the strings that appear in the list box.

Vcl.DBCtrls.TDBListBox.Items inherits from Vcl.StdCtrls.TCustomListBox.Items. All content below this line refers to Vcl.StdCtrls.TCustomListBox.Items.

Contains the strings that appear in the list box.

Use Items to add, insert, delete and move items. By default, the items in a list box are of type TStrings. Use this item type to access its methods or properties to manipulate the items in the list.

For example, the following code snippet shows how to add the text in the edit box to the list box as an item:

  ListBox1.Items.Add(Edit1.Text);
  ListBox1->Items->Add(Edit1->Text);

Tip: If you have a list box with multiple columns and you want to add data to specific columns, then you need to use the ^I parameter (that is, capital i; Delphi-only) in the Add statement, as shown in the snippet below.

  ListBox1.Items.Add('First Column'^I'Second Column');
  ListBox1.Items.Add('1'^I'2');
  ListBox1.Items.Add('4'^I'5');

And the result would be:

ListBoxIParam.png

See Also

Code Examples