procedure isNull(grp:TGroupBox);var I:Integer;const arr: array[0..1] of string = ('edit1为空', 'edit2为空');begin for I := 0 to grp.ControlCount - 1 do begin if grp.Controls[i] is TEdit then begin if (grp.Controls[i] as TEdit).Text = '' then begin showmessage(arr[i]); B:=false; end; end; end; // forend;{判断grp中的edit是否为空}
//调用方式为isNull(grp1)