setLength(tmpstatic,0);
tmpstatic:=nil;
setlength(tmpedit,0);
tmpedit:=nil;
with datamodule1.SQLQuery1 do
begin
sql.Clear;
sql.add('select e_amount from shd_d'+zt+' where s_order_d="'+form44.Label7.Caption+'"');
open;
SetLength(tmpstatic,rowsaffected);
setlength(tmpedit,rowsaffected);
for i:=0 to rowsaffected-1 do
begin
tmpstatic[i]:=Tstatictext.Create(self);
tmpstatic[i].Parent:=GroupBox1;
tmpstatic[i].Caption :=fieldbyname('e_amount').AsString;
tmpstatic[i].Width:=100;
tmpstatic[i].Top:=i*25+45;
tmpstatic[i].Left:=18;
// tmpcheck[i].OnClick:=CheckBoxClick;
tmpstatic[i].Show; tmpedit[i]:=Tedit.Create(self);
tmpedit[i].Parent:=GroupBox1;
tmpedit[i].text :=fieldbyname('e_amount').AsString;
tmpedit[i].Width:=100;
tmpedit[i].Top:=i*25+45;
tmpedit[i].Left:=150;
tmpedit[i].Show;
Next;
end; //end for
close;
end; //end with
以上是在单击事件中
是这样的,如果第一次有两个数组,第二次有一个数组的话,显示时还是有两个控件。
怎么解决?
tmpstatic:=nil;
setlength(tmpedit,0);
tmpedit:=nil;
with datamodule1.SQLQuery1 do
begin
sql.Clear;
sql.add('select e_amount from shd_d'+zt+' where s_order_d="'+form44.Label7.Caption+'"');
open;
SetLength(tmpstatic,rowsaffected);
setlength(tmpedit,rowsaffected);
for i:=0 to rowsaffected-1 do
begin
tmpstatic[i]:=Tstatictext.Create(self);
tmpstatic[i].Parent:=GroupBox1;
tmpstatic[i].Caption :=fieldbyname('e_amount').AsString;
tmpstatic[i].Width:=100;
tmpstatic[i].Top:=i*25+45;
tmpstatic[i].Left:=18;
// tmpcheck[i].OnClick:=CheckBoxClick;
tmpstatic[i].Show; tmpedit[i]:=Tedit.Create(self);
tmpedit[i].Parent:=GroupBox1;
tmpedit[i].text :=fieldbyname('e_amount').AsString;
tmpedit[i].Width:=100;
tmpedit[i].Top:=i*25+45;
tmpedit[i].Left:=150;
tmpedit[i].Show;
Next;
end; //end for
close;
end; //end with
以上是在单击事件中
是这样的,如果第一次有两个数组,第二次有一个数组的话,显示时还是有两个控件。
怎么解决?
解决方案 »
- 图片存入数据库
- 几年了再次发贴, 散200分庆宽祝下神七发射成功!!!
- 请教高手WORD自动化中的表格问题,急!!!
- Synedit的专门讨论组,欢迎大家参加.
- 如何快速在网上发文件,要代码 +50
- 如何实现在一台计算机上对另一太计算机的监控?(有点难哦)
- 多表查询中的问题,请高手指教!!!
- tikkypeng(千两狂死郎)和lovewangj(lllll)
- TcomboBox,Style=csDropDownList,怎么让里面有一个默认的值显示呢?
- 谁能回答Tshape 从 Tgraphiccontrol 继承而来,而Tshape却没有canvas属性?
- 如何用Delphi写个启动征途或传奇的程序?给个方法 ?好像是启动了个.dat文件?有做过的么
- 在工程中引用 uCnFastStream 单元,指定是那个位置引用??
procedure TForm1.Button2Click(Sender: TObject);
var
i: integer;
begin
for i:=0 to rowsaffected-1 do
begin
FreeAndNil(tmpstatic[i]);
FreeAndNil(tmpedit[i]);
end;
end;