Autor Beitrag
Hannah1990
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mi 20.09.06 12:22 
Okay, ich bins ma wieder und bräuchte ein erneutes Mal eure Hilfe :)

also, Aufgabe ist es,dass sich auf Klick auf das Formular die Aufschrift eines Labels ändert. N#mlich das nacheinander alle Vokale auftauchen.
Ich hab bischer folgendes geschrieben :

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:
procedure TForm1.FormClick(Sender: TObject);
begin
if lblVokal.Caption := 'a'
then lblVokal.Caption := 'e'
else begin
  if lblVokal.Caption := 'e'
  then lblVokal.Caption := 'i'
  else begin
     if lblVokal.Caption := 'i'
     then lblVokal.Caption := 'o'
     else begin
       if lblVokal.Caption := 'o'
       then lblVokal.Caption = 'u'
       else begin
         if lblVokal.Caption := 'u'
         then lblVokal.Caption := 'a'

end;
  end;
    end;
      end;
        end;


end.


So, ich kireg die Fehlermeldung, dass der Audruckstyp BOOLEAN sein muss. Was mach ich falsch?
So hat mir das n guter Freund erklärt, und ich war auch der Meinung, dass das richtig is?!


Moderiert von user profile iconChristian S.: Topic aus VCL (Visual Component Library) verschoben am Mi 20.09.2006 um 16:05


Zuletzt bearbeitet von Hannah1990 am Mi 20.09.06 14:44, insgesamt 1-mal bearbeitet
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 20.09.06 12:28 
Titel: Re: Wer kann mir helfen?
1) solche Titel sind blöd! keiner Weiß um was es geht! bitte nen in zukunft dein Themen richtig und sinnvoll!

user profile iconHannah1990 hat folgendes geschrieben:


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:
procedure TForm1.FormClick(Sender: TObject);
begin
if lblVokal.Caption := 'a'
then lblVokal.Caption := 'e'
else begin
  if lblVokal.Caption := 'e'
  then lblVokal.Caption := 'i'
  else begin
     if lblVokal.Caption := 'i'
     then lblVokal.Caption := 'o'
     else begin
       if lblVokal.Caption := 'o'
       then lblVokal.Caption = 'u'
       else begin
         if lblVokal.Caption := 'u'
         then lblVokal.Caption := 'a'

end;
  end;
    end;
      end;
        end;


end.



if is ne Abfage das heißt bei jedem if gehört statt dem := ein =. und bei dem Then ist eine zuweisung. das heißt es gehört ein := statt dem =.

außerdem ist es schlampiger Stil aber das war nicht deine Frage! ;-)

mfg el

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Hannah1990 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 16



BeitragVerfasst: Mi 20.09.06 12:41 
Alles klar, dankeschön :)
didiwerdau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67

Win 2000
C# 2008 Express Edition
BeitragVerfasst: Mi 20.09.06 13:54 
Du darfst in ner If-Abfrage kein := verwenden. Das ist ein Zuweisungsoperator. Du musst Das = als Vergleichsoperator verwenden.

Also
ausblenden Delphi-Quelltext
1:
2:
if lblVokal.Caption = 'a'
    then lblVokal.Caption := 'e'
didiwerdau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 67

Win 2000
C# 2008 Express Edition
BeitragVerfasst: Mi 20.09.06 13:56 
uuups, da war ich etwas zu langsam. Sorry.
Waldteufel
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 20.09.06 14:13 
Titel: Re: Wer kann mir helfen?
Hallo. :wave:

Delphi hat übrigens auch ein "else if". Das spart Platz:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.FormClick(Sender: TObject);
begin
       if lblVokal.Caption = 'a' then
         lblVokal.Caption := 'e'
  else if lblVokal.Caption = 'e' then
         lblVokal.Caption := 'i'
  else if lblVokal.Caption = 'i' then
         lblVokal.Caption := 'o'
  else if lblVokal.Caption = 'o' then
         lblVokal.Caption := 'u'
  else if lblVokal.Caption = 'u' then
         lblVokal.Caption := 'a';
end;


Gruß,
Waldteufel