zoukankan      html  css  js  c++  java
  • delphi 遍历控件

    有10个EDIT控件,取名为EDT1,EDT2,EDT3。。。EDT10,如何用一个循环知道哪个EDIT控件的值是空的?procedure   TForm1.Button2Click(Sender:   TObject);   
      var   
          I:integer;   
      begin   
          for   i:=0   to   Self.Componentcount-1   do//Self.Componentcount就是TForm1的控件数量   
          begin   
              if   Self.Components[i]   is   TEdit   then     //判断控件是否为TEdit   
              begin   
                  if   (Self.Components[i]   as   TEdit).Text=''   then   ShowMessage(Self.Components[i].Name);   
              end;   
          end;   
      end;  
    利用这个function   FindComponent(const   Name:   string)函数你可以找到你要的任何控件,然后判断它是否为空. 使用Tedit.findcomponents(edit(I))函数,i为控件的序号,具体看一下帮助!
    还有一个方法就是给他们的TAG赋同一个值,比如1,其他默认为零,程序如下:   
      procedure   TForm1.Button2Click(Sender:   TObject);   
      var   
          I:integer;   
      begin   
          for   i:=0   to   Self.Componentcount-1   do//Self.Componentcount就是TForm1的控件数量   
          begin   
              if   Self.Components[i]   is   TEdit   then     //判断控件是否为TEdit   
              begin   
                  if   (Self.Components[i]   as   TEdit).Text='')   
                        and   (Self.Components[i]   as   TEdit).tag=1)   then     
                      ShowMessage(Self.Components[i].Name);   
              end;   
          end;   
      end;  

  • 相关阅读:
    POI实现Excel导入数据库数据
    POI对Excel进行读取操作,工具类,便于操作数据
    HAProxy-1.8.20 根据后缀名转发到后端服务器
    Haproxy-1.8.20 编译安装:
    Soat控制HaProxy 动态增减服务器
    Haproxy-1.8.20 根据路径(URI)转发到后端不同集群
    Ansible User 模块添加单用户并ssh-key复制
    Ansible-playbook 安装redis
    二进制安装mysql-5.7.28
    编译安装 nginx -1.14.2
  • 原文地址:https://www.cnblogs.com/plug/p/4652327.html
Copyright © 2011-2022 走看看