当前位置:主页>仓库管理软件> 列表

如何查找另外窗体上的控件? 找免费进销存

财务软件版1楼: Form1上的Edit1控件名称存储于变量str(也可能是edit2);
如何在form2内给edit.text负值,要通过str;

2楼: procedure TForm1.Button2Click(Sender: TObject);
var
i : integer;
begin
for i := 0 to Form1.ComponentCount - 1 do
begin
if Form1.Components[i].Name = ''str'' then
begin
(Form1.Components[i] as TEdit).Text := ''***'';
Break;
end;
end;
end; 如免费进销存

3楼: 不遍历可以吗?

4楼: Tedit(Form1.FindComponent(str)).text :='' ''

5楼: if Form1.FindComponent(str) is TEdit then
(Form1.FindComponent(str) as TEdit).Text := ''ABC'';

6楼: 收到!谢谢!

财务软件版7楼: 多人接受答案了。