用法不一样,。net中使用swithch
vb中代码
Select Case itemc
Case 1
Response.Write("1")
Case 2
Response.Write("2")
Case 3
Response.Write("3")
Case 4
Response.Write("4")
Case Else
Response.Write("other")
End Select
vb。net中代码
switch (itemc)
{
case 1:
Response.Write("1");
break;
case 2:
Response.Write("2");
break;
case 3:
Response.Write("3");
break;
case 4:
Response.Write("4");
break;
default:
Response.Write("other");
break;
}
虽然都叫vb但是在用法上还是存在差异,语法问题
试试:
Select Case D.DriveType
Case DriveTypeConst.CDRom
Label16.Text = "光驱"
Case DriveTypeConst.Fixed
Label16.Text = "固定磁盘"
Case DriveTypeConst.RamDisk
Label16.Text = "RAM磁盘"
Case DriveTypeConst.Remote
Label16.Text = "网络磁盘"
Case DriveTypeConst.Removable
Label16.Text = "可移动磁盘"
Case DriveTypeConst.UnknownType
Label16.Text = "未知磁盘类型"
End Select