Autor Beitrag
Jona
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Do 19.04.07 15:29 
Folgendes Problem... wenn ich das Programm ausführen will zeigt er mir an, dass der Konstantenausdruck verletzt wird.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
procedure TForm1.ComboBox1Change(Sender: TObject);
var Blub, Bla:String;
begin
case ComboBox1.ItemIndex of
0:winexec  ('C:\Programme\Mozilla Firefox\firefox.exe' , SW_Shownormal);
1:winexec  ('C:\WINNT\system32\sol.exe' , SW_Shownormal);
2:winexec  ('C:\Programme\Adobe\Photoshop 6.0\Photoshp.exe' , SW_Shownormal);
3: close;
4:blub:=memo1.Text;
bla:=memo2.Text;
memo3.Text:= blub + bla;

end;
end;



Wo liegt der Fehler?

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 19.04.07 15:38 
Wo tritt der Fehler auf?
Ich würde besser
case (Sender as ComboBox).ItemIndex of
schreiben.

_________________
Markus Kinzler.
Jona Threadstarter
Hält's aus hier
Beiträge: 5



BeitragVerfasst: Do 19.04.07 15:42 
daran kann es eigentlich nicht liegen

die fehlermeldung ist bei "4:" vor "memo2"
FiceGoesDelphi
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 485

Win XP Prof
Delphi 2006
BeitragVerfasst: Do 19.04.07 15:45 
Schreibe deinen Code doch bitte in [Delphi] [/Delphi] Tags!
Dann kopiere bitte die genaue Fehlermeldung und versuchs mal mit dem Debugger!

_________________
<(^^<) <(^^)> (>^^)>
===================
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 19.04.07 15:50 
bla ist keine Ordinal-Konstante:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
4: 
   begin 
       blub:=memo1.Text;
       bla:=memo2.Text;
       memo3.Text:= blub + bla; 
   end;

_________________
Markus Kinzler.
FiceGoesDelphi
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 485

Win XP Prof
Delphi 2006
BeitragVerfasst: Do 19.04.07 15:57 
Habe ich mir schon gedacht, dass man das in ein "Begin End" kapseln muss. ;)

_________________
<(^^<) <(^^)> (>^^)>
===================
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 19.04.07 16:02 
user profile iconFiceGoesDelphi hat folgendes geschrieben:
Habe ich mir schon gedacht, dass man das in ein "Begin End" kapseln muss. ;)

Warum hast du es dann nicht geschrieben?

_________________
Markus Kinzler.
FiceGoesDelphi
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 485

Win XP Prof
Delphi 2006
BeitragVerfasst: Do 19.04.07 16:05 
user profile iconmkinzler hat folgendes geschrieben:
user profile iconFiceGoesDelphi hat folgendes geschrieben:
Habe ich mir schon gedacht, dass man das in ein "Begin End" kapseln muss. ;)

Warum hast du es dann nicht geschrieben?


Weil ich bei sowas immer sehr vorsichtig bin!
Ich habe letztens auch nen Tip abgegeben (Ich bin ja noch ein Delphi-Newbie) und der war natürlich falsch und ich wurd direkt wieder "zerfleischt" *gg* Wenn ich mir wirklich sicher bin, dann Traue ich mich das *gg*

_________________
<(^^<) <(^^)> (>^^)>
===================
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Do 19.04.07 16:58 
user profile iconmkinzler hat folgendes geschrieben:
Wo tritt der Fehler auf?
Ich würde besser
case (Sender as ComboBox).ItemIndex of
schreiben.


Das würde ich nicht machen! Wenn er die gleiche Ereignisbehandlungsroutine in Button1Click aufruft, und einen falschen parameter mitgibt, dann kommt eine Exception...