Vcl.DBCtrls.TDBListBox.Items
Delphi
property Items 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 tab stops enabled (TabStop property) and you want to add data to specific columns, you can set the TabWidth property to obtain a list box in which individual lines can be displayed in columns, as long as they use tabs in their text, as shown in the snippet below (notice #9 is the tab character).
ListBox1.TabWidth := 50;
ListBox1.Items.Add('hi' + #9 + 'lo');
ListBox1.Items.Add('foo' + #9 + 'bar');
ListBox1.Items.Add('ki' + #9 + 'mo');
And the result would be:
See Also
- Vcl.StdCtrls.TCustomListBox.Clear
- Vcl.Controls.TCustomListControl.ItemIndex
- Vcl.StdCtrls.TCustomListBox.OnDrawItem
- Vcl.StdCtrls.TCustomListBox.Selected
- System.Classes.TStrings