Autor Beitrag
G-man
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Mo 05.04.04 19:39 
Moin,
ich schreibe gerade an einem Programm, das mit dynamischen Arrays umgeht und habe da be ich ungefähr folgenden code (liegt hier gerade nicht rum, versuchs mal aus dem Kopf):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
Images: Array of TImage;


procedure MeineForm.ErstelleImage(number: integer);
begin
 SetLength(Images, number+1);
 Images[number]:= TImage.Create(nil);
 {...} //irgenwelche weitere belanglose Konfigurationen
end;


Nun will ich meinetwegen das Bild des Images ändern und mache das ca. so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure MeineForm.BildÄndern(number: integer);
begin
 Images[number].Picture:= 'C:\Irgendeinbild.bmp';
end;


Wenn ich nun zur Laufzeit das Bild ändern will, kriege ich eine Fehlermeldung.
Was kann ich tun/ habe ich falsch gemacht???
Schon mal vielen dank für etwaige Antworten.[/delphi]

_________________
...To err is human, but to really foul things up requires a computer.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mo 05.04.04 20:07 
Verrätst Du uns auch, wie die Fehlermeldung lautet? :mrgreen:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Mo 05.04.04 20:11 
TImage ist kein String. Du weist diesem aber einen String zu.

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind
G-man Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Di 06.04.04 09:10 
Fehlermeldungng: Im Project Project1.exe ist eine Exception der Klasse EAccesViolation aufgetreten. Meldung: 'Zugriffesverletzung bei Adresse ...'

_________________
...To err is human, but to really foul things up requires a computer.
G-man Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Di 06.04.04 12:25 
Ist also ein Runtime-Error, der immer dann auftritt, wenn ich die procedure benutzen will, also hat das nichts damit zutun ,dass ich dem Image.Picture einen String übergebe, weil der Compiler dann beim compilieren schon meckern würde.

_________________
...To err is human, but to really foul things up requires a computer.
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Di 06.04.04 13:05 
Schonmal überprüft ob "number" im Gültigkeitsbereich liegt, also nicht größer als Length(Images) - 1 ist..?

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
G-man Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Di 06.04.04 13:14 
Ja also theoretisch habe ich diese Fehlerquelle schon abgegrast. Daran sollte as eigentlich nicht liegen... Werd?s mir trotzdem nochmal anschauen...

_________________
...To err is human, but to really foul things up requires a computer.
rokdd
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 329

Win XP
D6
BeitragVerfasst: Di 06.04.04 15:16 
@UC-Chewie: du hast recht. aber image.picture ist ein string!!! also ist schon so richtig

vielleicht kannst du mal die stellen von wo die procedure aufgerufen werden posten und die procedure überhaupt. ich hoffe du hast den source parat..


robert