Autor Beitrag
klezmor
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Fr 14.03.08 11:39 
Kann mir jemand sagen was ich hier falsch mache:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var
a,b:Tstrings;
begin
a:=Tstrings.Create;
b:=Tstrings.Create;

 for i:=1 to Stringgrid1.RowCount-1 do
 begin
   a.Add(Stringgrid1.Cells[1,i]);
   b.Add(Stringgrid1.Cells[2,i]);
 end;

Der debugger zeigt mir nämlich, dass in der forschleife irgendwas schief geht.

Danke im Voraus.
Mfg Klezmor.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
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: Fr 14.03.08 11:48 
Schau dir mal die Hilfe zu TStrings an. Lese, verstehe und ersetze
ausblenden Delphi-Quelltext
1:
2:
a:=Tstrings.Create; 
b:=Tstrings.Create;
durch z.B.
ausblenden Delphi-Quelltext
1:
2:
a:=TstringList.Create; 
b:=TstringList.Create;
Die Deklaration von a und b kannst du so lassen.

_________________
We are, we were and will not be.
klezmor Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 558


delphi 6 personal delphi 2005 personal
BeitragVerfasst: Fr 14.03.08 13:14 
Danke es funktioniert, wobei ich nicht mehr genau weiß was der unterschied zwischen virutellen und abstrakten Methoden ist.

_________________
"Beware of bugs in the above code; I have only proved it correct, not tried it." Donald Knuth
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Fr 14.03.08 13:24 
Dazu findet man einiges bei Google. ;)
Zitat:
Eine abstrakte Methode hat keinen Körper. (Sie besitzt keine Anweisungen.) Sie deklariert Zugriffsmodifizierer, Rückgabetyp und Methodensignatur gefolgt von einem Semikolon. Eine nicht-abstrakte Subklasse erbt die abstrakte Methode und muss eine nicht-abstrakte Methode definieren, die mit der abstrakten Methode übereinstimmt.

Die Quelle bezieht sich zwar auf C++, doch sollte das IHMO auch für Delphi gelten.
Notfalls hilft dir auch Wikipedia weiter. :P

Cheers,
Marc