首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

怎么循环读取 QRlabel 并动态对其 Caption 赋值

2012-12-15 
如何循环读取 QRlabel 并动态对其 Caption 赋值?报表中有许多表格,每一格子数据不同,我的想法是在每一格子

如何循环读取 QRlabel 并动态对其 Caption 赋值?
报表中有许多表格,每一格子数据不同,我的想法是在每一格子上放一QRlabel,并为每一QRlabel编流水号( 如A11,A12,A13等,希望在显示或打印前通过FOR i:=1 to n  do , 利用其流水号的特点组合不同的QRlabel名,并将具体数据赋给QRlabel.caption,而不是逐一的为每一个QRlabel.caption赋值。 以上想法可行吗?但如何组合不同的QRlabel名,如何找到具体的QRlabel,并为之赋值?或有否其他方法?

for i:=0 to 10 do
begin
  
from1.这里如何动态得到A+i.caption:=xxx
...

end;



[解决办法]
终于找到答案啦,希望对其它朋友有帮助!

Uses QRCtrls; 一定要有这句,调了半天就是差着这句

    for i:=1 to 16  do
    begin
       if TComboBox(FindComponent('C_'+inttostr(i))).Text<>'==' then
       begin
       (QrFmExpenseCX.findcomponent('C'+inttostr(i)) as tqrlabel).caption:=TComboBox(FindComponent('C_'+inttostr(i))).Text;
       (QrFmExpenseCX.findcomponent('G'+inttostr(i)) as tqrlabel).caption:=TEdit(FindComponent('E_GW'+inttostr(i))).Text;
       (QrFmExpenseCX.findcomponent('B'+inttostr(i)) as tqrlabel).caption:=TEdit(FindComponent('E_BL'+inttostr(i))).Text;

       end;

热点排行