我动态创建了一个dbgrid对象,当用free释放时,编译出错信息为:
[Warning] unit3.pas(78): Variable 'wtgd' might not have been initialized
部分代码如下:
try
wtgd:=tdbgrid.Create(nil);
wtgd.DataSource:=datamodule1.DataSource5;
finally
wtgd.Free;
end;请各位高手指点,谢谢!
[Warning] unit3.pas(78): Variable 'wtgd' might not have been initialized
部分代码如下:
try
wtgd:=tdbgrid.Create(nil);
wtgd.DataSource:=datamodule1.DataSource5;
finally
wtgd.Free;
end;请各位高手指点,谢谢!
解决方案 »
- 在线等JAVA转换成DELPHI
- Delphi检测网页是否能打开
- 一个关于delphi的socket的问题。
- 因业务需要,本公司高薪聘Delphi开发人员
- windows下文件复制和移动的原理是怎么样的呀
- 子窗体中操作数据库
- 谁用过MS的TTS5.1,在delphi中的AxtiveX类为:TDirectSR,TDirectSS,TTexttoSpeech,安装了中文,却仍发英文.参数也不会调.谁用过的指点一下..
- Delphi 取Dom中的节点,如何判断所取的节点不存在?
- TQuery与TupdateSQL有什么区别
- 谢谢~请帮我看一下错误~这是个自动随机出题的小程序
- delphi新手交流专用群:11835856
- 谁有好的DELPHI开发群???!!!本人收集中!!!!目前我的群数已达20。
这是个警告信息,说你的dbgrid没有初始化,不用管它的。
这样写应该就没有了。
wtgd:=tdbgrid.Create(nil);
try
wtgd.DataSource:=datamodule1.DataSource5;
finally
wtgd.Free;
end;
try
... // process file F
finally
CloseFile(F);
end;The syntax of a try...finally statement istry statementList1 finally statementList2 endwhere each statementList is a sequence of statements delimited by semicolons. The try...finally statement executes the statements in statementList1 (the try clause). If statementList1 finishes without raising exceptions, statementList2 (the finally clause) is executed. If an exception is raised during execution of statementList1, control is transferred to statementList2; once statementList2 finishes executing, the exception is re-raised. If a call to the Exit, Break, or Continue procedure causes control to leave statementList1, statementList2 is automatically executed. Thus the finally clause is always executed, regardless of how the try clause terminates.If an exception is raised but not handled in the finally clause, that exception is propagated out of the try...finally statement, and any exception already raised in the try clause is lost. The
finally clause should therefore handle all locally raised exceptions, so as not to disturb propagation of other exceptions.