Einzelnen Beitrag anzeigen

Patrick162

Registriert seit: 24. Sep 2007
8 Beiträge
 
Delphi 7 Enterprise
 
#13

Re: Probleme mit einem Rechner

  Alt 4. Okt 2007, 15:56
Nächstes Problem:


'' is not a valid floating point value



Habe jetzt schon diverse Sachen ausprobiert, aber wieder keinen Erfolg gehabt

Ich hoffe ihr könnt mir jetzt noch einmal helfen...

Hier die Source:


Delphi-Quellcode:
unit Kreisberechnung;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Button1: TButton;
    Button2: TButton;
    ComboBox1: TComboBox;
    procedure Button1Click(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  r, u, d, A, r2: extended;
  ergebnis1, ergebnis2, ergebnis3, ergebnis4: string;
  pi: extended;
  lol: integer;


implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

r := strtofloat(Edit1.Text);
u := strtofloat(Edit2.text);
d := strtofloat(Edit3.Text);
A := strtofloat(Edit4.Text);
pi := 3.14159265358;

if lol = 1 then
ergebnis2 := Format('%.2f',[2* pi * r]);
Label2.Caption := ergebnis2;
ergebnis3 := Format('%.2f',[2* r]);
Label3.Caption := ergebnis3;
ergebnis4 := Format('%.2f',[pi* r * r]);
Label4.Caption := ergebnis4;

if lol = 2 then
ergebnis1 := Format('%.2f',[u / 2 * pi]);
Label1.Caption := ergebnis1;
r2 := strtoint(ergebnis1);
ergebnis3 := Format('%.2f',[r2 * 2]);
Label3.Caption := ergebnis3;
ergebnis4 := Format('%.2f',[pi* r2 *r2]);
Label4.Caption := ergebnis4;

if lol = 3 then
ergebnis1 := Format('%.2f',[d / 2]);
Label1.Caption := ergebnis1;
r2 := strtoint(ergebnis1);
ergebnis2 := Format('%.2f',[2* pi * r2]);
Label2.Caption := ergebnis2;
ergebnis4 := Format('%.2f',[pi* r2 * r2]);
Label4.Caption := ergebnis4;

if lol = 4 then
ergebnis1 := Format('%.2f',[pi * A / 2]);
Label1.Caption := ergebnis1;
r2 := strtoint(ergebnis1);
ergebnis2 := Format('%.2f',[2* pi * r]);
Label2.Caption := ergebnis2;
ergebnis3 := Format('%.2f',[r2* 2]);


end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin

case Combobox1.ItemIndex of
0: lol := 1;
1: lol := 2;
2: lol := 3;
3: lol := 4;
end;

if lol = 1 then
Edit1.Enabled := True;

if lol = 2 then
Edit2.Enabled := True;

if lol = 3 then
Edit3.enabled := true;

if lol = 4 then
Edit4.enabled := True


end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Enabled := False;
Edit2.Enabled := False;
Edit3.Enabled := False;
Edit4.Enabled := False;
end;

end.





Danke schön schonmal im voraus!
Greets
  Mit Zitat antworten Zitat