Posted by Joe on June 11, 2001
How can I create a Delphi TOpenDialog component on the fly?
For example, I want to create the component so it is local to that routine and not global (when you put a component on the form).
Example:
procudure Button1Click(Sender : TObject);
var
OpenFile: TOpenDialog;
begin
if not OpenFile.Execute then
exit;
end;
This does not work! WHY???
Re: Jean Claude Servaye on June 12, 2001
OpenFile := TOpenDialog.Create(Self); // add this line
if not OpenFile.Execute then
exit;
..... code here if the user select a file and press ok
OpenFile.Free // and this at the end of your routine
end;
Re:Re: Joe on June 13, 2001
Thanks!!!
|