AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Einfaches Addieren klapt nicht!

Ein Thema von litsa · begonnen am 29. Aug 2006 · letzter Beitrag vom 29. Aug 2006
 
Benutzerbild von litsa
litsa

Registriert seit: 6. Jul 2006
Ort: Detmold
51 Beiträge
 
Delphi 2006 Architect
 
#1

Einfaches Addieren klapt nicht!

  Alt 29. Aug 2006, 08:17
Sorry für den langen code aber kann mir bitte jemand sagen wo hier der Fehler is?! Und zwar wird die Summe nicht richtig ausgegeben (s. Kommentar):
Delphi-Quellcode:
procedure TDFSMain.Button5Click(Sender: TObject);
var
  shcount, i, edtop: integer;
  dirs: array[0..20] of string;
  Total: cardinal;
begin
  try
    Label5.Show;
    for i := 0 to 20 do
    begin
      if TEdit(Findcomponent('T' + IntToStr(i))) <> nil then
        TEdit(Findcomponent('T' + IntToStr(i))).Destroy;
      if TEdit(Findcomponent('p' + IntToStr(i))) <> nil then
        TEdit(Findcomponent('P' + IntToStr(i))).Destroy;
      if TEdit(Findcomponent('s' + IntToStr(i))) <> nil then
        TEdit(Findcomponent('S' + IntToStr(i))).Destroy;
    end;
    if TEdit(Findcomponent('sum')) <> nil then
      TEdit(Findcomponent('sum')).Destroy;
  finally
    //ProgressBar1.Position := 0;
    //ProgressBar1.Update;
    Total := 0;
    Totalsize := 0;
    shcount := grFS.RowCount;
    edtop := 40;
    for i := 0 to shcount - 1 do
    begin
      with TEdit.Create(self) do
      begin
        Name := 'T' + IntToStr(i);
        parent := FSPC6;
        Left := 8;
        Top := edtop + 32;
        edtop := Top;
        Width := 121;
        Clear;
        Show;
        ReadOnly := True;
        Font.Color := clBlue;
        Text := grFS.Cells[0, i];
      end;
    end;
    edtop := 40;
    for i := 0 to shcount - 1 do
    begin
      with TEdit.Create(self) do
      begin
        Name := 'P' + IntToStr(i);
        parent := FSPC6;
        Left := 136;
        Top := edtop + 32;
        edtop := Top;
        Width := 513;
        Clear;
        Show;
        ReadOnly := True;
        Font.Color := clGreen;
        Text := grFS.Cells[1, i];
        dirs[i] := Text;
      end;
    end;
    edtop := 40;
    for i := 0 to shcount - 1 do
    begin
      with TEdit.Create(self) do
      begin
        Name := 'S' + IntToStr(i);
        totalsize := 0;
        parent := FSPC6;
        Left := 656;
        Top := edtop + 32;
        edtop := Top;
        Width := 121;
        ReadOnly := True;
        Clear;
        Show;
        try
          find(dirs[i]); //hier werden die ordnergrössen richtig ermittelt(gecheckt)..
          Text := FormatBytes(totalsize); //..und richtig ausgegeben
          Total := Total + Totalsize; //lediglich die Summe ist hier falsch!
        finally
        end;
      end;
    end;
    Label6.Top := edtop + 36;
    Label6.Left := 572;
    Label6.Visible := True;
    with TEdit.Create(self) do
    begin
      Name := 'sum';
      parent := FSPC6;
      Left := 656;
      Top := edtop + 32;
      edtop := Top;
      Width := 121;
      ReadOnly := True;
      Font.Color := clRed;
      Clear;
      Show;
      Text := FormatBytes(total);
    end;
    //ProgressBar1.Position := 100;
    Label5.Hide;
  end;
end;
Danke
Evangelia
Evangelia
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:22 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz