Autor Beitrag
klaus33
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 10.01.08 15:05 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.BeinzelerwClick(Sender: TObject);
var Tarif:Integer;
begin
Tarif:=strtoint(memo2.Lines.Strings[0]);
Tarif:=2.50;
Memo2.Lines.Strings[0]:=inttostr(Tarif);
end;


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
covel
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 131

Win XP PRo
Borland D7/C#
BeitragVerfasst: Do 10.01.08 15:10 
Tarif darf nicht als Integer deklariet werden...
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: Do 10.01.08 15:13 
ausblenden Delphi-Quelltext
1:
2:
var 
 Tarif: Real;
klaus33 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 10.01.08 15:13 
Als was soll ich es denn sonst deklarieren
klaus33 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Do 10.01.08 15:15 
Danke alles erledigt
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: Do 10.01.08 15:16 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.BeinzelerwClick(Sender: TObject);
var 
 Tarif: Real;
begin
 Tarif:= StrToFloat(memo2.Lines.Strings[0]);
 Tarif:= 2.50;
 Memo2.Lines.Strings[0]:= FloatToStr(Tarif);
end;



Macht doch eh keinen Sinn, du speicherst in deiner Variablen 'Tarif' einen Wert ab und überschreibst ihn direkt wieder...
Mike19
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 256

Win XP, Vista, Win 7
Delphi 2005, Turbo Delphi
BeitragVerfasst: Do 10.01.08 15:17 
Mach doch nicht jedesmal ein neues Thema auf, sondern gib Deinem Thema einen aussagekräftigen Titel.

So nun zu Deinem Problem:

wenn Du den Tarif als Integer Variable deklarierst, kannst Du nicht 2.5 zuweisen (Grundlagen)

was soll denn dann im MemoFeld stehen ? etwa 2.5 ?
klaus33 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Fr 11.01.08 15:24 
Titel: Die Zeile in die Bedingung einbauen
Es ist zwar eine blöde Frage aber wie kann ich LStatus.Caption:='2.50' mit in die Bedingung einbauen
In diesem Fall überspringt er diesen Befehl. Delphi6

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
If Memo2.Lines.Strings[0]='2301' then 
Memo2.Lines[1]:='Bitte zahlen Sie '+FloatToStr(2.50)+' Euro'; 
LStatus.Caption:='2.50'; 

if Memo2.Lines.Strings[0]='2501' then 
Memo2.Lines[1]:='Bitte zahlen Sie '+FloatToStr(3)+' Euro'; 
LStatus.Caption:='70';


Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Mike19
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 256

Win XP, Vista, Win 7
Delphi 2005, Turbo Delphi
BeitragVerfasst: Fr 11.01.08 15:32 
Nun nochmals, beachte bitte auch mal die Kritiken, welche hier gegeben werden. Setze bitte Deinen Quelltext auch als solchen ein. Sollen wir nun wieder alle raten, was z.B. "LStatus" ist.

Nun zu Deiner Frage:

Wenn nach eine If-Abfrage mehrere Anweisungen ausgeführt werden sollne, müssen diese mit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
If Memo2.Lines.Strings[0]='2301' then 

begin
 Memo2.Lines[1]:='Bitte zahlen Sie '+FloatToStr(2.50)+' Euro'; 
 LStatus.Caption:='2.50';
end; 

if Memo2.Lines.Strings[0]='2501' then 

begin
 Memo2.Lines[1]:='Bitte zahlen Sie '+FloatToStr(3)+' Euro'; 
 LStatus.Caption:='70';
end;
klaus33 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Fr 11.01.08 15:47 
Danke