i:=0;
while i<29 do
begin
person1.Caption:=dbgrid1.Fields[i].asstring;
//person[i].caption:=dbgrid1.fields[i].asstring;想这样实现就是一个标签对应着一个字段,然后字段有29个标签也有29个.如果要这样实现的话是不是要遍容器里的所有控件?有没有例子呢??29个标签在panel1上面
i:=i+1;
end;
while i<29 do
begin
person1.Caption:=dbgrid1.Fields[i].asstring;
//person[i].caption:=dbgrid1.fields[i].asstring;想这样实现就是一个标签对应着一个字段,然后字段有29个标签也有29个.如果要这样实现的话是不是要遍容器里的所有控件?有没有例子呢??29个标签在panel1上面
i:=i+1;
end;
Num:integer;
i:integer;
begin
for num:=0 to gb_yxsgkxx.controlcount-1 do
if gb_yxsgkxx.controls[num].ClassName='TLabel' then
for i:=0 to dbgrid1.recordcount-1
if (gb_yxsgkxx.controls[num] as TLabel).tag=i then
begin
(gb_yxsgkxx.controls[num] as TLabel).caption:=dbgrid1.Fields[i].asstring;
break;
end;