Autor Beitrag
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Fr 17.03.06 16:25 
Hallo zusammen bei folgender Schleife sollte diese eigentlich bis 29 laufen
und Daten in ein Stringgrid schreiben. Es werden aber nur 27 Zeilen ins Stringgrid geschrieben :?!?:
Wo liegt mein Fehler.?
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
//BrAnz=29
//z=1
While z<=BrAnz do begin
   If HochZahlFrau[f]>HochZahlMann[m] then
    begin
     With StringGridHochZahlMinderheit do Begin
      Cells[0,z]:=FloatToStr(Frauen);
      Cells[1,z]:='Frauen';
      Cells[2,z]:=IntToStr(f);
      Cells[3,z]:=Format('%8.6n',[HochZahlFrau[z]]);
      Cells[4,z]:=IntToStr(z);
      cells[5,z]:='<---Minderheit';
     end;
     inc(f);;
     inc(z);
    end
    else
    begin
     With StringGridHochZahlMinderheit do Begin
      Cells[0,z]:=FloatToStr(Maenner);
      Cells[1,z]:='Männer';
      Cells[2,z]:=IntToStr(m);
      Cells[3,z]:=Format('%8.6n',[HochZahlMann[z]]);
      Cells[4,z]:=IntToStr(z);
      inc(m);
      inc(z);
     end;
    end; //ende If
  end;   //ende While
  LabelMinderheitSitze.Caption:='Für die Minderheit (Frauen) sind '+IntToStr(f-1)+' BR-Sitze zu reservieren.';
  LabelMinderheitFM.Caption:='Die Frauen sind in der Minderheit.';
end;     //ende Procedure


Dank im Vorraus
Miri
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 657


Delphi 3 Prof., Delphi 2005 PE
BeitragVerfasst: Fr 17.03.06 16:47 
hmm...so seh ich da erstmal nix... könnt höchstens sein, dass deine variablen (i und BrAnz) nicht richtig besetzt sind... hast du's mal mit

for i:=1 to 29 do

anstatt while und inc versucht?

ansonsten würd ich dir mal empfehlen, den debugger zeile für zeile drüber zu jagen und die variablen zu kontrollieren...
der Berliner Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Fr 17.03.06 17:04 
:autsch: Au weia Ich glaub ich sitz schon zu lange vor der Kiste

habe im Objektinspektor rowcount auf 27 gesetzt das ganze auf 100 erhöht und siehe da es funktioniert.

Danke für Eure Mühe ..ich glaub ich geh Heiern :wink:
starsurfer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 334

Win 95, Win 98, Win XP, Win Vista, Linux
D5 Enterprise ,D2005, D6 Personal, Visual C++ Express 2005, C++ Builder 6 E, Dev-C++
BeitragVerfasst: Fr 17.03.06 17:05 
//EDIT:ok hat sich ja erledigt....

_________________
GEIZ IST GEIL! - Ihr Sozialamt