Autor Beitrag
raiha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Fr 27.05.05 09:58 
Hi ich möchte zur Laufzeit ein Formular anlegen. Dazu mache ich folgendes:


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var Survey: Tfrm_survey;

... 

Survey:= Tfrm_survey.Create(Self);
Survey.Show;


Das Formular wird daraufhin angezeigt aber wenn ich aber versuche auf eine im Formular enthaltene Query zuzugreifen kommt eine Zugriffsverletzung.

Was kann das sein. Ist das Frm noch nicht "ganz fertig initialisiert" ?


Danke Rainer

Moderiert von user profile iconChristian S.: Code- durch Delphi-Tags ersetzt.
matze.de
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 576

Win95, Win98 SE, WinXp Prof SP2
D7P, D8P, FPC2.0
BeitragVerfasst: Fr 27.05.05 10:56 
Woher sollen wir wissen was "Tfrm_survey" ist bzw. was dahinter steckt?
Denn an der Erstellung liegt es nicht, die is so richtig.

mfg matze

_________________
si tacuisses, philosophus mansisses.
raiha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Fr 27.05.05 11:17 
Vielleicht habe ich das nicht deutlich genug geschrieben. Ich habe im Vorfeld ein Formular erstellt und lasse das jetzt nicht mit Application.CreateForm(Tfrm_survey, frm_survey);

sondern eben mit

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
var Survey: Tfrm_survey;

... 

Survey:= Tfrm_survey.Create(Self);
Survey.Show;


anlegen.

Muss ich da noch was machen das ich auf die Komponeten des Formulars zugreifen kann? Warum bringt er den Fehler?

Danke Rainer
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Fr 27.05.05 11:27 
Theoretisch ist das egal, wie du es machst. Sobald das Create gemacht wurde, solltest du genauso drauf zugreifen können, als wäre es automatisch erstellt worden.
Dein Fehler ist vrmtl. woanders zu suchen. Aber alles was man jetzt sagen würde, wäre sinnlose Raterei.
Bist du sicher, dass alles geht, wenn du es automatisch erzeugen lässt?
raiha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Fr 27.05.05 11:36 
Geht ganz sicher wenn ichs automatisch machen lasse. Habe es gerade nochmal probiert.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Fr 27.05.05 11:41 
Da hilft vermutlich nur, wenn du den Source des Projektes bereit stellst. Einfach als Dateianhang hochladen.
raiha Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152



BeitragVerfasst: Fr 27.05.05 11:46 
Habs jetzt anders gemacht. Mache zur Laufzeit.

Application.CreateForm(Tfrm_survey, frm_survey);

Das kann ich zur LZ auch ohne Probleme wieder löschen wenn ich muss :-) .


Danke Rainer