急救!!comboBox的问题??? 想单击一次“添加”按钮就在comboBox里添加一个Items,并在text中显示出来,应该怎么实现?用哪个属性?对这个组件我不熟悉,希望各位提示一下。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 combobox1.items.add();combobox1.index:=combobox1.items.count; procedure TForm1.Button1Click(Sender: TObject);begincombobox1.Items.Add(edit1.Text);ComboBox1.ItemIndex:=ComboBox1.Items.Count-1;end; unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) cbb1: TComboBox; Button1: TButton; procedure FormShow(Sender: TObject); procedure Button1Click(Sender: TObject); private { Private declarations } public i: integer; { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormShow(Sender: TObject);begin i:=0; cbb1.Text:=IntToStr(i);end;procedure TForm1.Button1Click(Sender: TObject);begin Inc(i); cbb1.Items.Add(IntToStr(i)); cbb1.Text:=IntToStr(i);end;end. procedure TForm1.Button1Click(Sender: TObject); begin ComboBox1.Items.Add(edit2.Text); {添加edit2的内容到ComboBox1} Edit1.Text:=ComboBox1.Items.Strings[ComboBox1.Items.Count-1]; {显示添加的内容(最后一项)到Edit1}end; 求救:关于TIdTCPServer接收数据 100分送上! 怎样检查一个文本框中的字符是否为double类型? 程序绑定 IE 讨论 OnCloseQuery 急!!!! 谁有好的ToolBar控件啊 请教一个用InstallShield for delphi5做安装程序出错的问题! 怎样才能回车替换tab? Delphi中的INI文件编程 哪个属性设置dbgrid的标题不可以移动. 如何给QReport的TQRDBText组件统一赋值 delphi7编译的程序在VISTAR上无法运行,请问如何解决?? 如何在画布上画一个矩形,然后在该矩形中写字,一行写不下自动换行?
begin
combobox1.Items.Add(edit1.Text);
ComboBox1.ItemIndex:=ComboBox1.Items.Count-1;
end;
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
cbb1: TComboBox;
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
i: integer;
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormShow(Sender: TObject);
begin
i:=0;
cbb1.Text:=IntToStr(i);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
Inc(i);
cbb1.Items.Add(IntToStr(i));
cbb1.Text:=IntToStr(i);
end;end.
begin
ComboBox1.Items.Add(edit2.Text); {添加edit2的内容到ComboBox1}
Edit1.Text:=ComboBox1.Items.Strings[ComboBox1.Items.Count-1]; {显示添加的内容(最后一项)到Edit1}
end;