Ich glaub ungefähr so:
Delphi-Quellcode:
var
Form2s: array of TForm2;
procedure TForm1.Button1Click(Sender: TObject);
var i: longint;
begin
i := 1;
if Length(Form2s) > 0 then
for i := 0 to Length(Form2s) do
begin
if Form2s[i] <> nil then
begin
if Form2s[i].Caption = Edit1.Text then
begin
Form2s[i].Show;
break;
end;
end;
end;
if i = Length(Form2s) + 1 then
begin
SetLength(Form2s, Length(Form2s) + 1);
Form2s[Length(Form2s)] := TForm2.Create(Form1);
Form2s[Length(Form2s)].Caption := Edit1.Text;
Form2s[Length(Form2s)].Show;
end;
end;
Aber beim schließen des Hauptfensters treten lauter Fehler auf! Weiß jemand warum?