ItemIndex: Integer;
The ItemIndex property determines the index of the selected list element.
The property is set to -1 by default, and no list element is selected.
Executing the example requires that the repository contains a web form and the ComboBox component named ComboBox1 on the form. The specified procedure is set as a handler of the OnShow event for the web form.
Add a link to the Collection system assembly.
Sub TESTWebFormOnShow;
Var
Items: IStringList;
Begin
Items := New StringList.Create;
Items.Add("A");
Items.Add("B");
Items.Add("C");
Items.Add("D");
// Set up component
ComboBox1.Items := Items;
ComboBox1.ItemIndex := 0;
End Sub TESTWebFormOnShow;
When the web form is started, a list of elements is created and the first element is selected in the ComboBox1 component.
See also: