本文介绍了控件不能从一个案例标签('default:')转到另一个案例标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! private void PlaceRandom() { int r,c; r = 10; c = 10; int i = 0; ar = 0; ac = 0; 随机rnd = new Random(); int val; while(i< 8) { val = rnd.Next(9); if(numNotExists(val)== true && val> 0) { pos [ar,ac] = val; 开关(val) { 案例1: lbl1.Location = new Point(c,r); break; case 2: lbl2.Location = new Point(c,r); 休息; 案例3: lbl3.Location = new Point(c,r); 休息; 案例4: lbl4.Location = new Point(c,r); 休息; 案例5: lbl5.Location = new Point(c,r); 休息; 案例6: lbl6.Location = new Point(c,r); 休息; 案例7: lbl7.Location = new Point(c,r); 休息; 案例8: lbl8.Location = new Point(c,r); 休息; 默认: } c + = 100; ac ++; if(ac> 2) { ac = 0; ar ++; } 如果(c> 300) { c = 10; r + = 100; } i ++; } 其他 继续; } lblBlank.Location = new Point(c,r); pos [2,2] = 9; } 它显示错误控制不能从一个案例标签中掉落('默认:')到另一个在开关案例的默认声明中,我无法理解为什么 和什么可能是共振private void PlaceRandom() { int r, c; r = 10; c = 10; int i = 0; ar = 0; ac = 0; Random rnd = new Random(); int val; while (i < 8) { val = rnd.Next(9); if (numNotExists(val) == true && val > 0) { pos[ar, ac] = val; switch (val) { case 1: lbl1.Location = new Point(c, r); break; case 2: lbl2.Location = new Point(c, r); break; case 3: lbl3.Location = new Point(c, r); break; case 4: lbl4.Location = new Point(c, r); break; case 5: lbl5.Location = new Point(c, r); break; case 6: lbl6.Location = new Point(c, r); break; case 7: lbl7.Location = new Point(c, r); break; case 8: lbl8.Location = new Point(c, r); break; default: } c += 100; ac++; if (ac > 2) { ac = 0; ar++; } if (c > 300) { c = 10; r += 100; } i++; } else continue; } lblBlank.Location = new Point(c, r); pos[2, 2] = 9; }it showing an error "control cannot fall through from one case label ('default:') to another" at the default statement of the switch case i cant understand whyand what could be the reson推荐答案default: break;} 请通过此链接了解开关声明的详细信息 http://www.dotnetperls.com/case 这篇关于控件不能从一个案例标签('default:')转到另一个案例标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-18 09:54