Einzelnen Beitrag anzeigen

akazukilp

Registriert seit: 3. Sep 2020
17 Beiträge
 
#1

TStringgrid zählt nur bis 10

  Alt 15. Okt 2020, 18:01
Delphi-Version: 5
Hallo zusammen,

ich bin neu was das programmieren angeht und versuche heute ein Programm zu schreiben, dass in einem Stringgrid das 75 Col und 10 Rows hat diese von 1 bis 750 zu befüllen.
Mein Problem ist jetzt, dass wen ich das Programm ausführe, zählt er in der 1 Zeile nur bis 10 und nicht bis 75.
Woran liegt das?

Delphi-Quellcode:
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Grids;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Button1: TButton;
    Button2: TButton;
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
  i, J, z : Integer;
begin
   z:=0;
  with StringGrid1 do
    for I := 1 to ColCount - 1 do
      for J:= 1 to RowCount - 1 do

        begin
          if Cells[j,i] = 'then begin
          inc(z);
          Stringgrid1.Cells[j,i] := IntToStr(z);

          end;
        end;
end;

end.
Danke schon mal im voraus für die Antworten.
Grüße Basti

Geändert von mkinzler (15. Okt 2020 um 20:29 Uhr) Grund: Delphi Code Tag
  Mit Zitat antworten Zitat