> I want to test whether any instance of form has already been created and if
> not create an instance. I can always try a Form.Show and trap for the access
> violation, but there must be a more elegant way of doing this.

Use your own instance variable

var
  MyInstanceVariable :TForm1;
begin
  MyInstanceVariable := TForm1.Create(application);
  try
    Do some stuff
  finally
    MyInstanceVariable.Release;
  end;
end;

This way you can have several of the same form at once if you so desire...

Try to avoid referring to Global instancevariables as created by delphi automatically
as this nails your code down to a single-use model and restricts future development.

--
Aaron Scott-Boddendijk
Jump Productions
(07) 838-3371 Voice
(07) 838-3372 Fax


---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to