Autor Beitrag
Becks16
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Di 17.10.06 11:47 
Habe ein kleines problem ich führe eine berechnung durch und wenn ein edit feld leer ist soll eine showmessage kommen das feld ist leer . die message kommt auch und wenn ich dann ok drücke schmeißt er mich aus dem programm raus hier der quelltext

ausblenden 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:
procedure Tf_kalkulation.btn_berechnenClick(Sender: TObject);
var a, b, c: real;
begin

        a := StrToFloat(edit_preis.Text);
        b := StrToFloat(edit_preiskachelkamin.Text);
        c := a+b;
        edit_listenpreisgesamt.Text := FloatToStr(c);

if  edit_verkaufspreis.Text = '' then ShowMessage ('Es ist nichts zu berechnen da '); // hier die showmessage wenn ich danach auf ok drücken schmeißt er mich raus 
           
        a := StrToFloat(edit_listenpreisgesamt.Text);
        b := StrToFloat(edit_verkaufspreis.Text);
        c := b*100/a-100;
        edit_rabatt.Text := FloatToStr(c);

        a := StrToFloat(edit_listenpreisgesamt.Text);
        b := StrToFloat(edit_verkaufspreis.Text);
        c := b-a;
        edit_rabattgeld.Text := FloatToStr(c);






  end;



wie kann ich das ändern das er mich nicht raus schmeißt sondern das ich die möglichkeit habe den wert einzugeben

vielen dank schon mal

mfg

_________________
Ich bin Dumm und weiss nichts :-)
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Di 17.10.06 11:53 
Das passiert doch aber nur, wenn du das Programm über F9 startest, oder? :gruebel: Geh nach dem "Rausschmiss" in den Code und drücke wieder F9. ;)

MfG
freak

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
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: Di 17.10.06 11:56 
ausblenden 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:
procedure Tf_kalkulation.btn_berechnenClick(Sender: TObject);
var a, b, c: real;
begin

        a := StrToFloat(edit_preis.Text);
        b := StrToFloat(edit_preiskachelkamin.Text);
        c := a+b;
        edit_listenpreisgesamt.Text := FloatToStr(c);

if  edit_verkaufspreis.Text = '' then ShowMessage ('Es ist nichts zu berechnen da ')
else begin
           
        a := StrToFloat(edit_listenpreisgesamt.Text);
        b := StrToFloat(edit_verkaufspreis.Text);
        c := b*100/a-100;
        edit_rabatt.Text := FloatToStr(c);

        a := StrToFloat(edit_listenpreisgesamt.Text);
        b := StrToFloat(edit_verkaufspreis.Text);
        c := b-a;
        edit_rabattgeld.Text := FloatToStr(c);





  end;
  end;

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Di 17.10.06 12:04 
ne das funtz nicht jetzt habe ich ne menge fehlermeldungen wenn ich wieder mit begin anfange denn kennt er da runter die variablen nicht mehr er meckert rum weil bei
ausblenden Delphi-Quelltext
1:
edit_verkaufspreis.Text = '' then ShowMessage ('Es ist nichts zu berechnen da ') // weil hier beim = kein doppelpunkt gemacht habe denn meckert er rum wegen then . Then gefunden aber end erwartet					


woran mag das liegen

mfg

_________________
Ich bin Dumm und weiss nichts :-)
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: Di 17.10.06 12:10 
Poste nochmal den ganzen geänderten Code.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Becks16 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 405



BeitragVerfasst: Di 17.10.06 12:15 
du hat sich erledigt ich habe das IF vergessen

ich danke dir marco funktioniert wunderbar

mfg

_________________
Ich bin Dumm und weiss nichts :-)