Einzelnen Beitrag anzeigen

Benutzerbild von freak4fun
freak4fun

Registriert seit: 22. Sep 2004
Ort: Hannover
1.807 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#10

Re: Eine Schleife für die Labels mit Variablenzuordnung(Arra

  Alt 3. Mai 2005, 15:42
Zitat von Hallo_Thomas:
Also so sieht der Spass ganz aus, wo ich die Labels einzeln angegangen bin(siehe oben) hats geklappt




Delphi-Quellcode:
begin
  for i:=0 to 9 do
  Counte[i]:=0;
  for pl0 := Form1.Anzeige.count-1 DownTo 0 do
    begin
      if StrToInt(Form1.Anzeige.Items[pl0]) in [0,10,20,30] then
      Counte[0] := 0
      else Inc(Counte[0]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [1,11,21,31] then
      Counte[1] := 0
      else Inc(Counte[1]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [2,12,22,32] then
      Counte[2] := 0
      else Inc(Counte[2]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [3,13,23,33] then
      Counte[3] := 0
      else Inc(Counte[3]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [4,14,24,34] then
      Counte[4] := 0
      else Inc(Counte[4]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [5,15,25,35] then
      Counte[5] := 0
      else Inc(Counte[5]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [6,16,26,36] then
      Counte[6] := 0
      else Inc(Counte[6]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [7,17,27] then
      Counte[7] := 0
      else Inc(Counte[7]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [8,18,28] then
      Counte[8] := 0
      else Inc(Counte[8]);
      if StrToInt(Form1.Anzeige.Items[pl0]) in [9,19,29] then
      Counte[9] := 0
      else Inc(Counte[9]);
      (FindComponent('form1.Label'+IntToStr(i+192)) as TLabel).Caption:=IntToStr(Counte[i]);
                                            ^
                                     Das i mein ich.
      end;
 end;
Entschuldige, ich hab mich falsch ausgedrückt. Bei der markierten Stelle(ganz unten), das i ist immer EIN konstannter Wert. Schau es dir mal an.

MfG
freak
Christian
IT: Schließen Sie bitte das Fenster. User: Die Tür auch?
i++; // zaehler i um 1 erhoehen
  Mit Zitat antworten Zitat