使用带有switch语句的dropdownlist [英] using dropdownlist with switch statement
本文介绍了使用带有switch语句的dropdownlist的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当天的问候,
嘿家伙我正在使用带有switch语句的dropdownlist但是我的代码运行不正常光标在任何情况下都没有停止并且只在默认情况下停止我要么选择喷墨或其他人帮助我紧急我发送我的代码我将非常感谢你。
greetings for the day,
hey guys i am using dropdownlist with switch statement but mine code is not working well the cursor is not stoping at any case and goin to stop only at default either i am selecting inkjet or the other guys kindly help me its urgent i am sending mine code i will highly thankful to you.
string entity;
entity = DropDownList1.SelectedItem.Text;
Label10.Text = entity;
switch (entity)
{
case 'inkjet':
int p = int.Parse( TextBox4.Text);
int g = p * 45;
Label12.Text = g.ToString();
break;
case "lazerprinter":
int f = int.Parse(TextBox4.Text);
int y = f * 66;
Label12.Text = y.ToString();
break;
default :
Label12.Text = "kindly select a printer type";
break;
}
推荐答案
entity = DropDownList1.SelectedItem.Text.trim();
试试这个......
Try this ..
这篇关于使用带有switch语句的dropdownlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文