Autor Beitrag
Koj
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16


Delphi 2005 Pers., Lazarus, NASM, FASM, VB 2005 EpressEdition
BeitragVerfasst: So 10.02.08 21:40 
Moin,

wenn ich folgenden Code ausführen will:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for x:= 0 to form1.ComponentCount-1 do
begin
if (form1.Components[x] is TButton)then
showmessage((form1.Components[x] as TButton).Caption);
end;


kommt diese Fehlermeldung:
Im Projekt Project1.exe ist eine Exception der Klasse EAccessViolation mit der Meldung 'Zugriffsverletzung bei Adresse 00419E53 in Modul 'Project1.exe'. Lesen von Adresse 0000001E' aufgetreten.

Wenn auf der Form nur ein Button ist, funktioniert es.

Kann mir einer sagen, woran das liegt?

MfG koj
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 11.02.08 01:24 
Das ist so eigentlich korrekt! Keine Ahnung, was da schief läuft, aber an dem Code kann es eigentlich nicht liegen (natürlich vorausgesetzt dein Formular heißt form1^^)...
DrRzf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 260

Win XP Prof
D7 Enterprise
BeitragVerfasst: Do 14.02.08 05:09 
der Fehler könnte auch an einer anderen procedure liegen.
ich vermute du überschreitest irgendwo nen index oder hast was nicht createt.
dynamisches array oder stringliste irgendwo im programm ?

_________________
rein statistisch gesehen darf man keiner statistik trauen die man nicht selbst gefälscht hat.
DecKeL
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 22

Windows XP
D7, D4 - Professional
BeitragVerfasst: Do 14.02.08 10:39 
lauf die schleife doch mal mit F8 durch, dann weißt du schon mal wo genau der Fehler kommt.
wenn du Mehrer Buttons hast, dann kennst du den richtigen.
erzeugst du die Buttons zur Laufzeit?