Creating this VCL application consists of the following steps:
New
Other
Delphi Projects or C++Builder Projects and double-click the VCL Forms Application icon. The VCL Forms Designer is displayed.
var StringList: TStrings;
For C++, enter the following variable declarations:
TStrings *StringList;
StringList := TStringList.Create; try with StringList do begin Add('Animals'); Add('Cats'); Add('Flowers'); end; with ComboBox1 do begin Width := 210; Items.Assign(StringList); ItemIndex := 0; end; Label1.Caption := 'Flowers has an index of ' + IntToStr( StringList->IndexOf( 'Flowers' ) ); finally StringList.free; end;
StringList = new TStringList(); try { StringList->Add( “Animals” ); StringList->Add( “Cats” ); StringList->Add( “Flowers” ); ComboBox1–>Width = 210; ComboBox1–>Items->Assign( StringList ); ComboBox1–>ItemIndex = 0; Label1–>Caption = “Flowers has an index of “ + IntToStr( StringList->IndexOf( “Flowers” ) ); } __finally { StringList->Free(); }
Run to build and run the application. The form displays with the controls. |
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
|
What do you think about this topic? Send feedback!
|