我正在检查文本框控件“txtType”中的一个值,我有 3 个可能的值:它是 TypeA、TypeB 或 TypeC。所以我想做的就是:这就是我到目前为止所拥有的
string myType= ((TextBox)DV_LogAdd.FindControl("txtType")).Text.ToString();
int updatedType;
If string myType = ‘TypeA’ then set updatedType to 1
If string myType = ‘TypeB’ then set updatedType to 2
If string myType = ‘TypeC’ then set updatedType to 3
我曾尝试使用 switch 语句,但搞砸了。