Autor Beitrag
Metschu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

Windows XP SP2 Home
Delphi 7; Delphi XE2-Starter
BeitragVerfasst: So 21.09.08 17:08 
Hallo zusammen!

Ich habe ein kleines Problem mit einer If then Else Anweisung:

Hier mal der Stark vereinfachte Quelltext:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
if checkbox.checked
 then
  if messagedlg('Soll Externes Programm strarten?'{...})=mryes
   then
    if shellexecute({...})<= 32  
     then
      showmessage('Fehler bei Shellexecute')
 else
  showmessage('Hinweis 1');


Die Else Anweisung bezieht sich nun ja logischerweise auf das "If Shellexecute".
Sie soll jedoch zu dem "If Checkbox" gehören.
Bekomme ich das irgendwie hin, ohne das hinter jedes "If" ein "else mach was sinnloses" einzufügen?

Vielen Dank schonmal.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8549
Erhaltene Danke: 478

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 21.09.08 17:16 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if checkbox.checked then 
begin
  if messagedlg('Soll Externes Programm strarten?'{...})=mryes then 
    if shellexecute({...})<= 32 then 
      showmessage('Fehler bei Shellexecute'); 
end
else 
  showmessage('Hinweis 1');

_________________
We are, we were and will not be.
Metschu Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 135

Windows XP SP2 Home
Delphi 7; Delphi XE2-Starter
BeitragVerfasst: So 21.09.08 17:26 
:autsch:
Da hätte ich auch selbst drauf kommen können :oops:
Ohne Hirn ist man wie blöd...

Vielen Dank!