Autor Beitrag
Abu36
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Mi 15.03.06 18:09 
hab mal eine kurze frage, wie kann ich denn die felder eines stringgrids leere. ich suche eine kurze möglichkeit

für jedes feld: stringgrid1.cells[0,0]:=' '; eingeben ist irgendwie ein bissel lang bei vielen felder.

danke


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mi 15.03.2006 um 17:53
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Mi 15.03.06 18:26 
man könnte es mit einer Schleife machen, wieviele Spalten hat deine Tabelle denn?
ungefähr so..:

ausblenden Delphi-Quelltext
1:
2:
3:
for i := 0 To StringGrid1.ColCount-1 Do
  for i2 := 0 To StringGrid1.RowCount-1 Do
    StringGrid1.Cells[i,i2] := '';


Zuletzt bearbeitet von Danniolo am Mi 15.03.06 18:29, insgesamt 2-mal bearbeitet
Abu36 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Mi 15.03.06 18:41 
danke Danniolo, funktioniert 1A
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Mi 15.03.06 18:42 
nzd :mrgreen:
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mi 15.03.06 20:02 
Hallo,

darfs etwas kürzer sein :zwinker:
ausblenden Delphi-Quelltext
1:
2:
for z := 0 to StringGrid1.RowCount-1 do
  StringGrid1.Rows[z].Clear;

Die Eigenschaft rows(TStrings) enthält alle Strings der Zellen einer Zeile,
da TStrings clear kennt, kann man so die Strings löschen.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )