Autor Beitrag
marvin521993
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 172



BeitragVerfasst: Mi 14.02.07 18:31 
Hi,

Wie kann man es machen, das man per button klick en ganzes stringgrid(50 zeilen) löscht?

mfg
Marvin


Moderiert von user profile iconTino: Topic aus Sonstiges (Delphi) verschoben am Mi 14.02.2007 um 17:34
Andidreas
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114

Windows XP Pro
BDS 2006
BeitragVerfasst: Mi 14.02.07 18:57 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
begin
  for I := 0 to StringGrid1.RowCount - 1 do
    StringGrid1.Rows[i].Clear
end;
greenhorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 68


D5
BeitragVerfasst: Mi 14.02.07 20:31 
Hallo Marvin,

es geht sehr Einfach. Hier mal der Code:

ausblenden Delphi-Quelltext
1:
StringGrid1.RowCount := 0;					


Wünsche Dir noch viel Spass und Erfolg.

GH
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 14.02.07 20:51 
Hallo,

@greenhorn
damit wird nur die Anzahl der sichtbaren Zeilen beeinflußt.
Die Inhalte in Cells[c,r] bzw. Rows[r] werden nicht gelöscht.
Demo-Beispiel:
ausblenden Delphi-Quelltext
1:
2:
3:
StringGrid1.Cells[1,1] := 'komme gleich wieder';
StringGrid1.RowCount := 0;
StringGrid1.RowCount := 5;
>> in Cells[1,1] steht ...

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