Autor Beitrag
JoeCotton
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 26



BeitragVerfasst: Mi 07.12.05 14:50 
Hallo zusammen,

ich verwende ein array of record, weiß aber beim verwenden noch nicht wie
groß es werden wird, da ich zur Lauzeit eine Tabelle durchlauf und daten in das
array schreib.

kann mir jemand sagen, wie und ob ich die array größe zur Lauzeit vergrößern kann?

Danke

Gruß Joe
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 07.12.05 14:53 
Siehe Delphi-Hilfe zu SetLength.
feivel3333
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 190

W7
Delphi XE prof
BeitragVerfasst: Mi 07.12.05 14:57 
Nimm folgendes:

SetLength( aArray, length( aArray )+1 );

Damit wird das Array um 1 Element verlängert.
Zugriff auf das letzte Element:

aArray[ length( aArray )-1 ] := ...

Deklaration des Arrays: var aArray : array of string; // z.B. für ein Array of strings

P.S. Verkürzen des Arrays ist nicht ganz so einfach...
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 07.12.05 15:25 
user profile iconfeivel3333 hat folgendes geschrieben:
P.S. Verkürzen des Arrays ist nicht ganz so einfach...

Ist genauso einfach:
ausblenden Delphi-Quelltext
1:
SetLength(DeinArray, 0);					

Und schwupps ist es leer.