Autor Beitrag
noo.bee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: So 02.05.10 22:57 
ich hab eine if schleife:

ausblenden Delphi-Quelltext
1:
2:
3:
if edit86.Text = edit1.Text then inc (Z1); // wenn beide gleich, dann Z1++
if Treffer1 <= 3 and Z1 := '1' then                // wenn Treffer1 grösser/gleich 3 UND Z1 = 1
label5.Text := '+ ZZ';                             // dann zeige "+ ZZ"


die zeigt folgende fehlermeldung: [DCC Fehler] lotto.pas(203): E2029 'THEN' erwartet, aber ':=' gefunden

die boardsuche habe ich bemüht. da habe ich das mit IF und AND hier gefunden:

ausblenden Delphi-Quelltext
1:
2:
if ((DayOfNow(Date) < 3and (Datum >= LastDayOfMonth2(Datum) -3)) or (Datum > (Date -3)) then 
begin

jetzt dachte ich, dass bei mir die klammern fehlen. das geht aber auch net bei mir... wo liegt denn mein fehler ?


Moderiert von user profile iconNarses: Topic aus VCL (Visual Component Library) verschoben am So 02.05.2010 um 23:00
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 02.05.10 22:59 
Moin!

user profile iconnoo.bee hat folgendes geschrieben Zum zitierten Posting springen:
ich hab eine if schleife:
Es gibt keine IF-Schleifen. :roll:

user profile iconnoo.bee hat folgendes geschrieben Zum zitierten Posting springen:
ausblenden Delphi-Quelltext
1:
2:
3:
if edit86.Text = edit1.Text then inc (Z1); // wenn beide gleich, dann Z1++
if Treffer1 <= 3 and Z1 :'1' then                // wenn Treffer1 grösser/gleich 3 UND Z1 = 1
label5.Text := '+ ZZ';                             // dann zeige "+ ZZ"
cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
noo.bee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: So 02.05.10 23:02 
ok, if-anweisung ;)

wenn ich aus := ein = mache, kommen 2 fehlermeldungen:

[DCC Fehler] lotto.pas(203): E2008 Inkompatible Typen
[DCC Fehler] lotto.pas(204): E2362 Auf protected-Symbol TControl.Text kann nicht zugegriffen werden
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 02.05.10 23:04 
Moin!

user profile iconnoo.bee hat folgendes geschrieben Zum zitierten Posting springen:
wenn ich aus := ein = mache, kommen 2 fehlermeldungen:

[DCC Fehler] lotto.pas(203): E2008 Inkompatible Typen
Dann rate ich mal, dass Z1 als Integer deklariert ist, du versuchst mit einem String zu vergleichen. Klappt nicht. :nixweiss:

user profile iconnoo.bee hat folgendes geschrieben Zum zitierten Posting springen:
[DCC Fehler] lotto.pas(204): E2362 Auf protected-Symbol TControl.Text kann nicht zugegriffen werden
Die von dir vermutlich gesuchte Eigenschaft heißt .Caption?

Eieiei, alles "Fehler", die man mit einem winzigen bisschen Lesen in der DOH auch selbst finden kann... :?

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.


Zuletzt bearbeitet von Narses am So 02.05.10 23:04, insgesamt 1-mal bearbeitet
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: So 02.05.10 23:04 
1. Setze Klammern um die Einzel-Abfragen
2. Bei nem Label heißt das Caption, nicht Text.

_________________
PROGRAMMER: A device for converting coffee into software.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 02.05.10 23:06 
Moin!

user profile iconXentar hat folgendes geschrieben Zum zitierten Posting springen:
1. Setze Klammern um die Einzel-Abfragen
Grundsätzlich gute Idee, hilft hier aber nicht gegen den Typen-Fehler. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
noo.bee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: So 02.05.10 23:15 
boah wie unklug von mir -.- türlich is das .caption und nicht .text :oops:

und mit den klammern hat soweit auch funktioniert.

Zitat:
...hilft hier aber nicht gegen den Typen-Fehler.

wie meinst du ?
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 02.05.10 23:22 
Moin!

user profile iconnoo.bee hat folgendes geschrieben Zum zitierten Posting springen:
und mit den klammern hat soweit auch funktioniert.

Zitat:
...hilft hier aber nicht gegen den Typen-Fehler.

wie meinst du ?
ausblenden Delphi-Quelltext
1:
2:
3:
if edit86.Text = edit1.Text then inc (Z1)// wenn beide gleich, dann Z1++
if Treffer1 <= 3 and Z1 = '1' then                // wenn Treffer1 grösser/gleich 3 UND Z1 = 1
label5.Caption := '+ ZZ';                             // dann zeige "+ ZZ"
Du willst mir doch nicht erzählen, dass man das mit einer Klammer in den Griff kriegt, oder? :| Du verwendest Inc(), also ist Z1 sehr wahrscheinlich ein Integer, so dass man da wohl kaum mit der String-Konstante '1' vergleichen kann. Hier sind die Hochkommata über, da braucht´s keine Klammer. Falls Z1 vom Typ Char ist, machte der Fehler keinen Sinn (wobei dann Zuweisung/Inc und Vergleich klappen sollten).

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.


Zuletzt bearbeitet von Narses am So 02.05.10 23:29, insgesamt 2-mal bearbeitet
noo.bee Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 120



BeitragVerfasst: So 02.05.10 23:24 
nein, hast natürlich recht. mein code sieht so aus:

ausblenden Delphi-Quelltext
1:
if (Treffer1 <= 3and (Z1 = 1then label38.caption := '+ ZZ';					
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 02.05.10 23:28 
Moin!

Markierst du den Thread noch entsprechend, wenn dein Problem gelöst ist? Danke. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.