初学,这个哪里错了
switch (comboBox2.Text)
{
case "xi":
str = "1";
case "ss":
str = "2";
default: str = "dd";
break;
}
提示 case有问题。请问怎么错了。谢谢
[解决办法]
提示信息已经很具体了,仔细看。
[解决办法]
是不是str没定义,
string str;
switch (comboBox2.Text)
{
case "xi":
str = "1";
case "ss":
str = "2";
default:
str = "dd";
break;
}
switch (comboBox1.Text)
{
case "xi":
str = "1";
break;
case "ss":
str = "2";
break;
default:
str = "dd";
break;
}
switch ( controllingExpression )
{
case constantExpression :
statements
break;
case constantExpression :
statements
break;
...
default :
statements
break;
}
例子:
switch (day)
{
case 0 :
dayName = "Sunday";
break;
case 1 :
dayName = "Monday";
break;
case 2 :
dayName = "Tuesday";
break;
...
default :
dayName = "Unknown";
break;
}