窗体有EDIT1、EDIT2到EDIT9个控件我想一次过改变其Enable属性为False,于是写下代码:procedure TForm3.BitBtn1Click(Sender: TObject);
var
I:Integer;
Y:String;
begin
For I:= 1 To 9 Do
Y:=IntToStr(I);
'Edit'+Y+'.Enable:=True';
end;但出错,捍示:[Error] MainAdd.pas(69): Statement expected, but expression of type 'String' found应该怎么写才正确呢?最后谢谢阅读!
var
I:Integer;
Y:String;
begin
For I:= 1 To 9 Do
Y:=IntToStr(I);
'Edit'+Y+'.Enable:=True';
end;但出错,捍示:[Error] MainAdd.pas(69): Statement expected, but expression of type 'String' found应该怎么写才正确呢?最后谢谢阅读!
var
iCount:Integer;
begin
for iCount:=0 to ControlCount-1 do
begin
if not (Controls[iCount] is TEdit) then Continue;
(Controls[iCount] as TEDit).Enabled:=true;
end;
end;
if Form3.Controls[i] is TEdit then TEdit(Form3.Controls[i]).Enabled := true;
var
iCount:Integer;
begin
for iCount:=0 to GroupBox1.ControlCount-1 do
begin
if not (GroupBox1.Controls[iCount] is TEdit) then Continue;
(GroupBox1.Controls[iCount] as TEDit).Enabled:=true;
end;
end;
var
i:Integer;
begin
for i:=0 to Self.ComponentCount-1 do
if self.Components[i] is TEdit then
(Self.Components[i] as TEdit).enabled:=False;
end;
if Form3.GroupBox1.Controls[i] is TEdit then TEdit(Form3.GroupBox1.Controls[i]).Enabled := true;
begin结贴!
楼主,不要以为给一个字符串赋值为'edit1'它就有了enable属性……
http://community.csdn.net/Expert/topic/4031/4031714.xml?temp=.2027399