delphi7关闭后显示runtime error 217 at 00402818 delphi7关闭后显示runtime error 217 at 00402818.不是很大的程序。之前建立了动态数组,出问题后全部屏蔽,问题依旧。请各位指点。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 error 217 即EControlC,是用户中断的异常类,检查是否有动态建立的对象没释放;如果有使用三方控件,试试另开工程对该控件进行测试。 谢谢!我又检查了一下,好象是在treeview上出错。在formactivate() 中treeview1.items[0].selected:=true;treeview1.selected.delete;treeview1.addfirst(nil,'第一个节点');//之后加入子节点..................在treeview1click()中varcode:string;begin code:=treeview1.selected.text;//////这一句出错,为什么? .................. varcode:string;begin if TreeView1.SelectionCount>0 then code:=treeview1.selected.text; 或:varcode:string;begin if TreeView1.Selected<>nil then code:=treeview1.selected.text; 要先判断TreeView1 . Selected<> nil才能用,否则内存错误 非常感谢,treeview的问题解决了,但老问题依旧。动态数组的代码如下:请帮忙看一下。procedure Txitongjianhua_form.FormActivate(Sender: TObject);varstr:string;i:integer;imageA,imageB:array of Timage; //¶¨ÒåͼƬÊý×ébegin mainform.adoquery1.Close; mainform.adoquery1.ConnectionString:=mainform.adoconnection1.ConnectionString; mainform.adoquery1.sql.clear; mainform.adoquery1.SQL.add('select * from wuchangmoxing where leixing=:a order by bianhao'); mainform.adoquery1.Parameters[0].value:='6'; try mainform.adoquery1.open; except showmessage('²»ÄÜ´ò¿ªÊý¾Ý¿â£¡'); end; setlength(imageA,mainform.adoquery1.RecordCount); //¶¨ÒåÊý×鳤¶È setlength(imageB,mainform.adoquery1.RecordCount); //¶¨ÒåÊý×鳤¶È stringgrid1.Rowcount:= mainform.adoquery1.RecordCount+1; stringgrid1.Cells[1,0]:=' ±àºÅ'; stringgrid1.Cells[3,0]:=' ±ê×¼½â'; stringgrid1.Cells[5,0]:=' ÎÊÌâÃèÊö'; //stringgrid1.Cells[7,0]:=' ±ê×¼½âϸ½Ú'; stringgrid1.colwidths[0]:=2; stringgrid1.colwidths[2]:=2; stringgrid1.colwidths[4]:=2; stringgrid1.colwidths[6]:=2; stringgrid1.colwidths[3]:=150; stringgrid1.colwidths[5]:=300; stringgrid1.colwidths[7]:=0; stringgrid1.Height:=100*mainform.adoquery1.RecordCount+40; stringgrid1.width:=550; for i:=1 to mainform.adoquery1.RecordCount do stringgrid1.RowHeights[i]:=100; i:=1; mainform.adoquery1.first; while not mainform.adoquery1.eof do begin stringgrid1.Cells[1,i]:= mainform.adoquery1.fieldbyname('bianhao').AsString; stringgrid1.Cells[3,i]:= mainform.adoquery1.fieldbyname('mingcheng').AsString; stringgrid1.Cells[5,i]:= mainform.adoquery1.fieldbyname('wentimiaoshu').AsString; str:= copy(mainform.adoquery1.fieldbyname('bianhao').AsString,3,6); imageA[i-1]:=Timage.Create(self); //¶¯Ì¬Éú³ÉͼƬ imageA[i-1].Parent:= xitongjianhua_Form; //·ÅÔÚµ±Ç°´°ÌåÖÐ imageB[i-1]:=Timage.Create(self); imageB[i-1].Parent:= xitongjianhua_Form; imageA[i-1].Width:=165; imageB[i-1].Width:=235; imageA[i-1].Height:=75; imageB[i-1].Height:=75; imageA[i-1].Left:=582; imageB[i-1].Left:=800; imageA[i-1].Top:=40+(i-1)*101; imageB[i-1].Top:=40+(i-1)*101; imageA[i-1].stretch:=true; imageB[i-1].stretch:=true; try imageA[i-1].picture.LoadFromFile(getcurrentdir()+'\sfpic\wt\wt'+str+'.jpg'); imageB[i-1].picture.LoadFromFile(getcurrentdir()+'\sfpic\fa\fa'+str+'.jpg'); except exit; end; //stringgrid1.Cells[7,i]:= 'µã»÷²é¿´...'; i:=i+1; mainform.adoquery1.next; end;end; 运行exe文件关闭时出现如题所示问题。 加了断点也没反应,就在applition 的end 处出现问题。怎么办啊????? Delphi SQL语句问题 如何将listview中的内容取出来并用逗号来分隔 delphi中rewrite怎么用的啊 asp调用dll输出一个乘法(怎样才能让fnuction 获得 procedure 内的变量结果~~) 在Delphi中如何生成的.exe文件不用安装Delphi软件也能执行。 程序中空语句也出错,why 怎样处理主-明细表的输入? 怎样给popupmenu添加背景图片呢? Login问题,我是新人! 如何实现象Oicq那样用户之间文件的相互传输? 数据插入后grid焦点问题 【求助】dxdbtreeview 节点拖动的问题!
我又检查了一下,好象是在treeview上出错。
在formactivate() 中
treeview1.items[0].selected:=true;
treeview1.selected.delete;
treeview1.addfirst(nil,'第一个节点');//之后加入子节点
..................
在treeview1click()中
var
code:string;
begin
code:=treeview1.selected.text;//////这一句出错,为什么?
..................
code:string;
begin
if TreeView1.SelectionCount>0 then
code:=treeview1.selected.text;
var
code:string;
begin
if TreeView1.Selected<>nil then
code:=treeview1.selected.text;
动态数组的代码如下:请帮忙看一下。
procedure Txitongjianhua_form.FormActivate(Sender: TObject);
var
str:string;
i:integer;
imageA,imageB:array of Timage; //¶¨ÒåͼƬÊý×é
begin
mainform.adoquery1.Close;
mainform.adoquery1.ConnectionString:=mainform.adoconnection1.ConnectionString;
mainform.adoquery1.sql.clear;
mainform.adoquery1.SQL.add('select * from wuchangmoxing where leixing=:a order by bianhao');
mainform.adoquery1.Parameters[0].value:='6';
try
mainform.adoquery1.open;
except
showmessage('²»ÄÜ´ò¿ªÊý¾Ý¿â£¡');
end; setlength(imageA,mainform.adoquery1.RecordCount); //¶¨ÒåÊý×鳤¶È
setlength(imageB,mainform.adoquery1.RecordCount); //¶¨ÒåÊý×鳤¶È stringgrid1.Rowcount:= mainform.adoquery1.RecordCount+1;
stringgrid1.Cells[1,0]:=' 񅧏';
stringgrid1.Cells[3,0]:=' ±ê×¼½â';
stringgrid1.Cells[5,0]:=' ÎÊÌâÃèÊö';
//stringgrid1.Cells[7,0]:=' ±ê×¼½âϸ½Ú'; stringgrid1.colwidths[0]:=2;
stringgrid1.colwidths[2]:=2;
stringgrid1.colwidths[4]:=2;
stringgrid1.colwidths[6]:=2;
stringgrid1.colwidths[3]:=150;
stringgrid1.colwidths[5]:=300;
stringgrid1.colwidths[7]:=0;
stringgrid1.Height:=100*mainform.adoquery1.RecordCount+40;
stringgrid1.width:=550; for i:=1 to mainform.adoquery1.RecordCount do stringgrid1.RowHeights[i]:=100;
i:=1; mainform.adoquery1.first;
while not mainform.adoquery1.eof do
begin
stringgrid1.Cells[1,i]:= mainform.adoquery1.fieldbyname('bianhao').AsString;
stringgrid1.Cells[3,i]:= mainform.adoquery1.fieldbyname('mingcheng').AsString;
stringgrid1.Cells[5,i]:= mainform.adoquery1.fieldbyname('wentimiaoshu').AsString;
str:= copy(mainform.adoquery1.fieldbyname('bianhao').AsString,3,6);
imageA[i-1]:=Timage.Create(self); //¶¯Ì¬Éú³ÉͼƬ
imageA[i-1].Parent:= xitongjianhua_Form; //·ÅÔÚµ±Ç°´°ÌåÖÐ
imageB[i-1]:=Timage.Create(self);
imageB[i-1].Parent:= xitongjianhua_Form;
imageA[i-1].Width:=165; imageB[i-1].Width:=235;
imageA[i-1].Height:=75; imageB[i-1].Height:=75;
imageA[i-1].Left:=582; imageB[i-1].Left:=800;
imageA[i-1].Top:=40+(i-1)*101; imageB[i-1].Top:=40+(i-1)*101;
imageA[i-1].stretch:=true; imageB[i-1].stretch:=true; try
imageA[i-1].picture.LoadFromFile(getcurrentdir()+'\sfpic\wt\wt'+str+'.jpg');
imageB[i-1].picture.LoadFromFile(getcurrentdir()+'\sfpic\fa\fa'+str+'.jpg');
except
exit;
end;
//stringgrid1.Cells[7,i]:= 'µã»÷²é¿´...';
i:=i+1;
mainform.adoquery1.next;
end;
end;