Einzelnen Beitrag anzeigen

Hansa

Registriert seit: 9. Jun 2002
Ort: Saarland
7.554 Beiträge
 
Delphi 8 Professional
 
#2

Re: StringGrid reihenweise füllen ?

  Alt 2. Apr 2006, 03:01
Zitat von RX3:
Delphi-Quellcode:
..
  for iCol := 1 to StringGrid1.ColCount do
  StringGrid1.Cells[iCol,0] := 'Planet '+ IntToStr(iCol);
  inc(iCol);

  for iRow := 1 to StringGrid1.RowCount - 1 do
    for iCol:= 0 to StringGrid1.ColCount - 1 do
      StringGrid1.Cells[0,iRow] := EditName.Text + ' | ' + EditAlly.Text;
      inc(iRow);
...
Als erstes sieht man mal nicht, wo (und ob überhaupt) RowCount erhöht wird. Folge : irgendwelche Fehler. Das nächste ist das "Inc". Hättest Du stattdessen i := i + 1 geschrieben, dann würde so was eher auffallen. Ausnahme sind Nanosekunden-Testprogramme. Du veränderst die for-Variable innerhalb der Schleife und das ist meist tödlich. Dann wird noch einmal bei 0 und dann bei 1 in den FOR-Schleifen begonnen.
Gruß
Hansa
  Mit Zitat antworten Zitat