判断groupbox中所有的edit是否为空,并给出空的哪个edit为空

    技术2022-05-20  29

     

    procedure TForm1.Button1Click(Sender: TObject);var  I:Integer;const  arr: array[0..1] of string = ('edit1为空', 'edit2为空');begin  for I := 0 to grp1.ControlCount - 1 do    begin //grp1即为groupbox1      if grp1.Controls[i] is TEdit then      begin        if (grp1.Controls[i] as TEdit).Text = '' then        begin showmessage(arr[i]); end;      endend; // forend;

     

    对于groupbox1中的edit1,2,3等等,赋值可用form1.edit.text这种方法


    最新回复(0)