|
![]() |
|
Registriert seit: 18. Sep 2009 29 Beiträge Delphi 7 Professional |
#1
Ich habe Matze's Beitrag nicht negativ gesehen. Hanz im Gegenteil... Er hat doch recht.
Jetzt aber noch ein Frage: Ich habe jetzt noch ein Funktion " in alles Umwandeln" hinzugefügt aber ich bekomme jetzt ganz ganz unter bei procedure TForm1.FormCreate(Sender: TObject); Mehrere Fehler: [Error] Unit1.dpr(308): Statement expected but 'PROCEDURE' found [Warning] Unit1.dpr(318): Text after final 'END.' - ignored by compiler [Fatal Error] mit_frage.dpr(5): Could not compile used unit 'Unit1.dpr' Ich komme nach einer Stunde immernoch nicht dahinter, wo der Fehler ist. Aber wenn ich habe das Gefühl, dass irgendwo ein Semikolon oder ähnliches Fehlt. Bevor ich die den letzten Teil (fänngt mit //----Celsius--- an) "geschrieben" habe, kam deer Fehler noch nicht. Woran kann das Blos liegen. Hier der Ganze Quelltext (im moment noch ohne eine Try-Anweisung ![]()
Delphi-Quellcode:
P.S.: danke DeddyH für deine ausführlich Erläuterung. Ich werde sie mir heute abend einmal gründlich durchlesen/studieren
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Edit1: TEdit; ComboBox1: TComboBox; ComboBox2: TComboBox; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Edit2: TEdit; Edit3: TEdit; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label9: TLabel; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var zahl, ergebnis : Real; // var myFloat: Extended; begin // if TryStrToFloat('Zahl', myFloat) then // ShowMessage(FloatToStr(myFloat)) // else // ShowMessage('Ungültige Eingabe'); zahl :=StrToFloat(Edit1.text); Label9.Caption := FloatToStr(zahl); // ------------------- Grad Celsius ----------------------------- // Von C° auf K if ComboBox1.text='C° (Celsius)' then begin if ComboBox2.text='K (Kelvin)' then begin ergebnis:=zahl+273.15; Edit1.Text:= FloatToStr(ergebnis); end else begin end end else begin end; // Von C° auf Fahrenheit if ComboBox1.text='C° (Celsius)' then begin if ComboBox2.text='F° (Fahrenheit)' then begin ergebnis:=zahl*9/5+32; Edit1.Text:= FloatToStr(ergebnis); end else begin end end else begin end; // Von C° auf C° if ComboBox1.text='C° (Celsius)' then begin if ComboBox2.text='C° (Celsius)' then begin Edit1.Text:= 'Selbe Einheit'; end else begin end end else begin end; // ------------------------- Ende Grad Celsius --------------------------- // ------------------------- Start Fahrenheit ----------------------------- // Von F° auf K if ComboBox1.text='F° (Fahrenheit)' then begin if ComboBox2.text='K (Kelvin)' then begin ergebnis:=(zahl + 459.67) / 1.8; Edit1.Text:= FloatToStr(ergebnis); end else begin end end else begin end; // Von F° auf Fahrenheit if ComboBox1.text='F° (Fahrenheit)' then begin if ComboBox2.text='F° (Fahrenheit)' then begin Edit1.Text:= 'Selbe Einheit'; end else begin end end else begin end; // Von C° auf C° if ComboBox1.text='F° (Fahrenheit)' then begin if ComboBox2.text='C° (Celsius)' then begin ergebnis:=(zahl - 32) / 1.8; Edit1.Text:= FloatToStr(ergebnis); end else begin end end else begin end; // -------------------------Ende Fahrenheit --------------------------- // ------------------------- Start Kelvin ----------------------------- // Von F° auf K if ComboBox1.text='K (Kelvin)' then begin if ComboBox2.text='K (Kelvin)' then begin Edit1.Text:= 'Selbe Einheit'; end else begin end end else begin end; // Von K° auf Fahrenheit if ComboBox1.text='K (Kelvin)' then begin if ComboBox2.text='F° (Fahrenheit)' then begin ergebnis:=zahl*1.8-459.67; Edit1.Text:= FloatToStr(ergebnis); end else begin end end else begin end; // Von K° auf C° if ComboBox1.text='K (Kelvin)' then begin if ComboBox2.text='C° (Celsius)' then begin ergebnis:=zahl-273.15; Edit1.Text:= FloatToStr(ergebnis); end else begin end end else begin end; // -------------------------Ende Kelvin --------------------------- // ------------------------ Alles Start ------------------------------- //----Kelvin--- if ComboBox1.text='K (Kelvin)' then begin if ComboBox2.text='Alle (C° F° K)' then begin Label5.Visible := True; Label6.Visible := True; Label7.Visible := True; // In Celsius umwandeln ergebnis:=zahl-273.15; Edit1.Text:= FloatToStr(ergebnis); // In Fahrenheit umwandeln Edit2.Visible := TRUE; ergebnis:=zahl*1.8-459.67; Edit2.Text:= FloatToStr(ergebnis); // In Kelvin umwandeln Edit3.Visible := TRUE; Edit3.Text:= 'Selbe Einheit'; //----Fahrenheit--- if ComboBox1.text='F° (Fahrenheit)' then begin if ComboBox2.text='Alle (C° F° K)' then begin Label5.Visible := True; Label6.Visible := True; Label7.Visible := True; // In Celsius umwandeln ergebnis:=(zahl - 32) / 1.8; Edit1.Text:= FloatToStr(ergebnis); // In Fahrenheit umwandeln Edit2.Visible := TRUE; Edit2.Text:= 'Selbe Einheit'; // In Kelvin umwandeln Edit3.Visible := TRUE; ergebnis:=(zahl + 459.67) / 1.8; Edit3.Text:= FloatToStr(ergebnis); //----Celsius--- if ComboBox1.text='C° (Celsius)' then begin if ComboBox2.text='Alle (C° F° K)' then begin Label5.Visible := True; Label6.Visible := True; Label7.Visible := True; // In Celsius umwandeln Edit2.Text:= 'Selbe Einheit'; // In Fahrenheit umwandeln Edit2.Visible := TRUE; ergebnis:=zahl*9/5+32; Edit2.Text:= FloatToStr(ergebnis); // In Kelvin umwandeln Edit3.Visible := TRUE; ergebnis:=zahl+273.15; Edit3.Text:= FloatToStr(ergebnis); end else begin end end else begin end; end; procedure TForm1.FormCreate(Sender: TObject); begin Edit2.Visible := FALSE; Edit3.Visible := FALSE; Label5.Visible := FALSE; Label6.Visible := FALSE; Label7.Visible := FALSE; end; end. end; end. ![]() |
![]() |
Ansicht |
![]() |
![]() |
![]() |
ForumregelnEs 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
|
|
Nützliche Links |
Heutige Beiträge |
Sitemap |
Suchen |
Code-Library |
Wer ist online |
Alle Foren als gelesen markieren |
Gehe zu... |
LinkBack |
![]() |
![]() |