Autor Beitrag
tortom1000
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175

Win XP, Win Server 2003 - 2012, Win 7
Delphi 7
BeitragVerfasst: Sa 03.06.06 11:11 
Hi,
ich habe 100 Edit-Felder, welche ich mit

for t:=1 to 100 do if editt.text='test' then editt.test:='TEST';

handeln möchte (sinngemäß).
Im ersten Durchlauf soll edit1.text, im zweiten edit2.text usw. bearbeitet werden.

Leider geht das aber so nicht...

Hat jemand dazu einen Tip parat.

Gruß
Tortom
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 03.06.06 11:16 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for i := 1 to 100 do
begin
  if (FindComponent('edit'+inttostr(i)) as TEdit).text='test' then
     (FindComponent('edit'+inttostr(i)) as TEdit).text:='Test';
end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
tortom1000 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175

Win XP, Win Server 2003 - 2012, Win 7
Delphi 7
BeitragVerfasst: Sa 03.06.06 11:29 
Hi, vielen Dank für die schnelle Hilfe.

Der Compiler meldet: [Fehler] Hauptformular.pas(3240): Undefinierter Bezeichner: 'FindComponent'

Muß ich sonst noch etwas ergänzen?

Gruß
Tortom
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Sa 03.06.06 11:37 
ich verweiße einfach mal auf dieses topic: klick mich ;)
tortom1000 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 175

Win XP, Win Server 2003 - 2012, Win 7
Delphi 7
BeitragVerfasst: Sa 03.06.06 11:41 
vielen Dank. (Ich hätte besser selber die Suchfunktion bemühen sollen...)
Gruß
Tortom
raiguen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 374

WIN 2000prof, WIN XP prof
D7EP, MSSQL, ABSDB
BeitragVerfasst: Sa 03.06.06 11:48 
Moin :)
So muss das heißen:
ausblenden Delphi-Quelltext
1:
2:
  if TEdit(FindComponent('edit'+inttostr(i))).Text ='test' then
    TEdit(FindComponent('edit'+inttostr(i))).Text :='TEST'

//EDIT: arrghh.. ein bissll zu spät :(
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Sa 03.06.06 11:50 
Nein, das ist doch egal ob nun TEdit() oder (xx as TEdit), oder? :gruebel:

Ich weiß zwar nicht genau was du vorhast, aber vielleicht hilft dir Uppercase() auch noch weiter :zwinker:

greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
raiguen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 374

WIN 2000prof, WIN XP prof
D7EP, MSSQL, ABSDB
BeitragVerfasst: Sa 03.06.06 15:09 
user profile iconBorn-to-Frag hat folgendes geschrieben:
Nein, das ist doch egal ob nun TEdit() oder (xx as TEdit), oder? :gruebel:

Ähm...stimmt! Beide 'Ausdrucks'formen sind richtig. Hab' mir halt 'meine' Schreibweise angewöhnt...
Im Übrigen ist die Schreibweise des Komonentennamens egal: ob Groß oder Klein oder gemischt, spielt keine Rolle