delphi问题:能否把列表框(LISTBOX)中选中的数字添加到编辑框中

来源:百度知道 编辑:UC知道 时间:2024/05/09 06:31:37
1.如果能,代码怎么写?
2.如不能,有没有其它合适的组件可以被添加数字?
3.特别注意:是通过按钮把listbox中已经存在的数字添加(或叫移动)到组件里,并显示出来。

在按钮的onclick里这样写:
Var Index :Integer;
begin
For Index:=0 To Listbox.Items.Count -1 Do
IF Listbox.Selected[Index]=True Then Begin
edtText.Text := Listbox.Items[Index]; //这里赋值。
Exit;
End;
end;