您的位置:首页 > 其它

遍历form上所有的控件,判断控件类型,然后抓数据

2006-07-17 22:42 330 查看

遍历form上所有的控件,判断控件类型,然后抓数据- -

                                      

如果是在自己编写的程序中,当然可以实现,可以通过
枚举的方法,如:
for i:=0 to ComponentCount-1 do
begin
  if (ComponentCounts[i] is TEdit) then
  begin
     vStr:=(ComponentCounts[i] as TEdit).Text;
  end;
  其它的依此类推.........
end;

var
  i: integer;
begin
  for i :=0 to Form1.ComponentCount do
  begin
    if Form1.Components[i].ClassType=你需要设定的控件类型 then
    ......
  end;
end;

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  integer
相关文章推荐