Autor Beitrag
LeVoS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33



BeitragVerfasst: So 16.01.05 13:29 
Kurze Frage ...
Kann man irgendwie auf folgende Art und Weise in Delphi auf Variablen zugreifen

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var a,b,c:string;
    varliste:TStringlist;

   varliste[0]:='a';
   varliste[1]:='b';
   varliste[2]:='c';

 for lauf=0 to 2 do
   ???varliste[lauf]???:='Test';


dannach sollten a,b,c mit 'Test' gefüllt sein ....

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 16.01.05 14:27 
wenn alle variablen den gleichen Typ haben, kannst du sowas machen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var abc : Array of string;
[..]
setlength(abc,3);
for lauf=0 to 2 do   
   abc[lauf]:='Test';

Das ganze ist natürlcih nur modulo Syntaxfehler richtig...

_________________
We are, we were and will not be.
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: So 16.01.05 14:47 
fehlt noch nen ":" bei der for schleife ;>
LeVoS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33



BeitragVerfasst: So 16.01.05 15:34 
schon klar - aber es geht hier um verschiedene Typen mit verschiedenen Namen ...
wenn nicht ist - muß ich wohl viel code schreiben ... :cry: