Autor Beitrag
xilos
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Mi 31.01.07 20:01 
hallo...

ich habe ein problem bei eienr aufgabe.
und zwar sollen wir einen "körperberechner" erstellen und dieser soll quader pyramiden usw berechnen.
ich habe aber ein kleines problem damit, dass ihr euch vielleicht einmal anguggen könntet.
wenn man zwischen den karteien wechseln will kommt eine fehlermeldung (auch beim berechnen der körper)
das programm ist als anhang dabei und hier ist der quelltext

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:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, TabNotBk, StdCtrls, jpeg, ExtCtrls;

type
  TForm1 = class(TForm)
    Quader: TTabbedNotebook;
    E_Q_SeiteA: TEdit;
    L_Q_SeiteA: TLabel;
    E_Q_SeiteB: TEdit;
    L_Q_SeiteB: TLabel;
    L_Q_SeiteC: TLabel;
    E_Q_SeiteC: TEdit;
    I_Quader: TImage;
    E_Q_Volumen: TEdit;
    L_Q_Volumen: TLabel;
    E_Q_Oberflaeche: TEdit;
    L_Q_Oberflaeche: TLabel;
    E_Q_Raumdiagonale: TEdit;
    L_Q_Raumdiagonale: TLabel;
    B_Q_Berechnung: TButton;
    L_Q_Ergebnisse: TLabel;
    L_Q_Eingaben: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    L_P_Eingabe: TLabel;
    L_P_Ergebnisse: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    L_P_SeiteA: TLabel;
    E_P_SeiteA: TEdit;
    L_P_SeiteS: TLabel;
    E_P_SeiteS: TEdit;
    L_P_HoeheH: TLabel;
    E_P_HoeheH: TEdit;
    L_P_Volumen: TLabel;
    E_P_Volumen: TEdit;
    E_P_Oberflaeche: TEdit;
    L_P_Oberflaeche: TLabel;
    B_P_Berechnung: TButton;
    Image1: TImage;
    procedure B_Q_BerechnungClick(Sender: TObject);
    procedure QuaderChange(Sender: TObject; NewTab: Integer;
      var AllowChange: Boolean);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.B_Q_BerechnungClick(Sender: TObject);
var zahl1, zahl2, zahl3 : real;

begin

zahl1 := strtofloat (E_Q_seiteA.text);
zahl2 := strtofloat (E_Q_seiteB.text);
zahl3 := strtofloat (E_Q_seiteC.text);

E_Q_Volumen.text       := floattostr (zahl1*zahl2*zahl3);
E_Q_Oberflaeche.text   := floattostr (2*(zahl1*zahl2 + zahl1*zahl3 + zahl2*zahl3));
E_Q_Raumdiagonale.text := floattostr (sqrt(sqr(zahl1)) + (sqr(zahl2)) + (sqr(zahl3)));


end;

procedure TForm1.QuaderChange(Sender: TObject; NewTab: Integer;
  var AllowChange: Boolean); var zahl1, zahl2, zahl3 : real;

begin

zahl1 := strtofloat (E_P_seiteA.text);
zahl2 := strtofloat (E_P_seiteS.text);
zahl3 := strtofloat (E_P_hoeheH.text);

E_P_Volumen.text       := floattostr  ( 0.5 * zahl1 * zahl2 *  zahl3) ;
E_P_Oberflaeche.text   := floattostr  ( 2 * zahl3 * zahl1) ;


end;


end.
Einloggen, um Attachments anzusehen!


Zuletzt bearbeitet von xilos am Do 01.02.07 14:57, insgesamt 1-mal bearbeitet
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 31.01.07 20:07 
Fehler:
Project1.exe hat folgendes geschrieben:

---------------------------
Project1
---------------------------
'' is not a valid floating point value.
---------------------------
OK
---------------------------

Das Problem liegt sicher bei den strtofloat-Anweisungen, da die Edits leer sind.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 31.01.07 20:08 
Hallo,

bitte ändere den Titel des Topics, da er wenig über das eigentlich Thema verrät. Hier der entsprechende Absatz aus den Richtlinien:

1.2 Beiträge:
Bitte formuliere den Betreff Deiner Beiträge so, dass andere Mitglieder anhand dieser bereits das eigentliche Thema festmachen können. Beiträge wie etwa "Eine Anfängerfrage" oder "Weiß jemand, wie das geht?" lassen den Leser im Unklaren darüber, was das Thema der Diskussion ist.[...]


Einfach oben bei Deinem ersten Beitrag auf user defined image klicken und den Titel ändern. Danke Dir!

_________________
We are, we were and will not be.
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Mi 31.01.07 20:11 
sieh mal hier unter MyStrToFloat

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
xilos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Do 01.02.07 15:00 
was meinst du mit "edits leer sind"??
und mit MyStrToFloat kann ich irgendwie nix anfangen
Kroko
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1284

W98 W2k WXP
Turbo D
BeitragVerfasst: Do 01.02.07 15:07 
user profile iconxilos hat folgendes geschrieben:
was meinst du mit "edits leer sind"??
und mit MyStrToFloat kann ich irgendwie nix anfangen

(a)
ausblenden Delphi-Quelltext
1:
Edit.Text=''; // das heißt kein Text eingegeben					

(b) ersetze StrToFloat durch MyStrToFloat und kopiere die Funktion in deine Quellen

_________________
Die F1-Taste steht nicht unter Naturschutz und darf somit regelmäßig und oft benutzt werden! oder Wer lesen kann, ist klar im Vorteil!
xilos Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 59



BeitragVerfasst: Do 01.02.07 20:36 
okay thx... hat sich erledigt... die befehle waren einfach im flaschen onClick xD

thx noch mal an alle

CLOSED