Re: form close
[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]
Posted by WAllison on May 10, 2002 at 22:18:24:
In Reply to: form close posted by Letizia on May 10, 2002 at 17:33:38:
: Can anyone tell me what TForm Close does in order to destroy the object it owns? Does it tests in some way if the objects still exist? : Creating a runtime instance of TTable and closing the Form from CloseBtClick I found that the code was compiled without error. I was making some test and some error was espected... : type : TFormDB = class(Tform) : .... : CreateTabelBt: TButton; : CloseBt: TButton; : end; : var : FormDB: TFormDB; : NewTbl: TTable; : NewDataSrc: TDataSource; : procedure TFormDb.CreateBtClick(Sender: TObject); : begin : NewTbl := TTable.Create(Self); : with NewTbl do begin : ..... : end; : end; : procedure TFormDB.CloseBtClick(Sender: TObject); : begin : NewTbl.Free; : Close; : end; : Thanks in advance when freeing up a object or component created at runtime its best to use:
if ObjectName <> nil then ObjectName.Free; or If Assigned(ObjectName) then ObjectName.Free;# might be worth setting active properties to false before trying to free up. (Close table) - Waz
Related Articles and Replies:
[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]
|