Einzelnen Beitrag anzeigen

Benutzerbild von Jelly
Jelly

Registriert seit: 11. Apr 2003
Ort: Moestroff (Luxemburg)
3.741 Beiträge
 
Delphi 2007 Professional
 
#5

Re: bei Form.create auf anderes Formular zugreifen

  Alt 10. Mär 2006, 13:20
Form1 wird normalerweise vor Form2 erzeugt. Die Reihenfolge steht in der .dpr Datei. Dort siehst du auch, wie das vor sich geht:

Delphi-Quellcode:
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.
Dein Oncreate Ereignis wird ausgelöst, beim CreateForm. Form2 ist also noch nicht erzeugt... Das muss Du also manuell im OnCreate von Form1 machen, und im Projekt die Zeile Application.CreateForm(TForm2,Form2) rausnehmen. (Am besten über Menupunkt Projekt->Optionen)
  Mit Zitat antworten Zitat