for I :=0 to count(数组) - 1 do begin case I of 0:begin edit1.text=''; end; 1:begin edit2.text=''; end; ...... end; end;
我本身還要做好EDIT與數組做好對應才行。
for i := 0 to Component.Count -1 do begin if Component[i] is TEdit then begin // 再判斷下他的TAG if TEDit(Components[i]).tag = 99 then TEDit(Components[i]).text := fields[99].asString; end; end;
我本身還要做好EDIT與數組做好對應才行。
for i := 0 to Component.Count -1 do begin if Component[i] is TEdit then begin // 再判斷下他的TAG if TEDit(Components[i]).tag = 99 then TEDit(Components[i]).text := fields[99].asString; end; end;
uses TypInfo;var PropInfo: PPropInfo; // 要使用 TypInfo 单元 count,i,k: integer; con:TComponent; begin count := 数组长度; for i := 0 to count - 1 do begin con := FindComponent('edit'+IntToStr(i+1)); if con = nil then Exit; PropInfo := GetPropInfo(con.ClassInfo, 'Text'); if Assigned(PropInfo) then SetStrProp(con, PropInfo, '第'+IntToStr(i+1)+'个'); end; end;
for I :=0 to count(数组) - 1 do
begin
case I of
0:begin
edit1.text='';
end;
1:begin
edit2.text='';
end;
......
end;
end;
for i := 0 to Component.Count -1 do
begin
if Component[i] is TEdit then begin
// 再判斷下他的TAG
if TEDit(Components[i]).tag = 99 then TEDit(Components[i]).text := fields[99].asString;
end;
end;
for i := 0 to Component.Count -1 do
begin
if Component[i] is TEdit then begin
// 再判斷下他的TAG
if TEDit(Components[i]).tag = 99 then TEDit(Components[i]).text := fields[99].asString;
end;
end;
PropInfo: PPropInfo; // 要使用 TypInfo 单元
count,i,k: integer;
con:TComponent;
begin
count := 数组长度;
for i := 0 to count - 1 do
begin
con := FindComponent('edit'+IntToStr(i+1));
if con = nil then
Exit;
PropInfo := GetPropInfo(con.ClassInfo, 'Text');
if Assigned(PropInfo) then
SetStrProp(con, PropInfo, '第'+IntToStr(i+1)+'个');
end;
end;