Autor Beitrag
beljo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Di 14.03.06 10:32 
Hallo Leute,
ich wollte gerne ein Methode Einlesen schreiben.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
 
procedure Einlesen ;
begin
 a:= StrToFloat(edit1.text);
 b:= StrToFloat(edit2.text);´// usw
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 Einlesen;
end;

Warum klappt sowas nicht? :cry:
Danke im vorraus.
Grishnak
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 221

Windows XP Home
Delphi 7 PE, Delphi 2005 PE
BeitragVerfasst: Di 14.03.06 10:41 
Wäre gut zu wissen, was nicht klappt bzw. welche Fehlermeldung kommt!

Versuchen wirs trotzdem:

- "a" und "b" müssen global deklariert sein
- da "Einlesen" keine Methode der Form ist, musst du per "Form1.Edit1.Text" bzw. "Form1.Edit2.Text" darauf zugreifen.

Würde dir vorschlagen, die Einlese-Routine als Methode von "TForm1" zu schreiben.

_________________
Mach' etwas idiotensicher und irgendjemand erfindet einen besseren Idioten!
MightyPit
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 22

Win XP
Delphi 2005 pro, Delphi 7
BeitragVerfasst: Di 14.03.06 10:48 
hmm was steht denn in edit1.text bzw edit2.text wenn du mit dem debugger hinläufst?
wenn da keine in float wandelbare Zahl drin steht, kachelts.
beljo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 129



BeitragVerfasst: Di 14.03.06 10:55 
Danke Grishnack,
genau das war es.
Gut zu wissen das man es so machen kann. :-)
cu