问题来源: http://www.cnblogs.com/del/archive/2008/12/09/1286648.html#1395694

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  ComboBox1.Items.CommaText := 'aaa,bbb,ccc,ddd';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ComboBox1.ItemIndex := 1;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ComboBox1.ItemIndex := ComboBox1.Items.IndexOf('ccc');
end;

end.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
猜你喜欢
  • 2022-03-08
  • 2022-02-23
  • 2021-06-22
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案