Autor Beitrag
kostonstyle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mi 20.01.10 16:30 
Hallo miteinander
könnte mir jemand bitte sagen was hier falsch sein soll.
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
switch (System.Windows.MessageBox.Show("Wollen Sie wirklich ändern?""PLU ändern",
                                                System.Windows.MessageBoxButton.YesNo, MessageBoxImage.Question))
                {
                    case MessageBoxResult.Yes:
                        plu_cl.change_value = change_value();
                        plu_cl.load_plu_file();
                }


Gruss kostonstyle
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 20.01.10 16:33 
Verrat uns doch bitte noch die Fehlermeldung ;-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
kostonstyle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mi 20.01.10 16:36 
entschuldige habe vergessen
ausblenden Quelltext
1:
Error  1  Control cannot fall through from one case label ('case 0:') to another  D:\Exercise\PLU_Change\PLU_Change\PLU.xaml.cs  68  21  PLU_Change					


Moderiert von user profile iconChristian S.: C#- durch Code-Tags ersetzt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 20.01.10 16:38 
Ah so, na klar. :idea: Jeder Zweig einer switch-Anweisung muss entweder mit break oder return beendet werden. Letzteres springt natürlich auch aus der kompletten Methode.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
Nemag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 132
Erhaltene Danke: 2



BeitragVerfasst: Mi 20.01.10 16:39 
du musst die case-anweisung mit einem break beenden.

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
case 1:
  //tue was
break;

case 2:
case 3:
 //tue was 
break;
kostonstyle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mi 20.01.10 16:43 
aha super vielen dank.