ListBox中的SelectedItem怎么写 求教了?

tykao_cyj 2010-11-10 07:09:32

private void userType_SelectedIndexChanged(object sender,EventArgs e)
{
this.userType=??????????
switch ("userType")
{
case "int":
showIntValue();
break;
}

}

private void showIntValue()
{
int num;
num = 42;
txtUser.Text = "42";
txtUser1.Text = "有符号32位整数,代表8位字符";



?后面怎么写?
...全文
130 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sylar13568789 2010-11-10
  • 打赏
  • 举报
回复
你那是搞什么?
tykao_cyj 2010-11-10
  • 打赏
  • 举报
回复
在线等呀 3楼的大哥 你说的我还是弄不出来
我的意思 先调出ListBox中的选项值 在 通过switch比较 如果 比较的值为一样就调出相对应的方法

兔子-顾问 2010-11-10
  • 打赏
  • 举报
回复
先判断
if(this.userType.SelectedItem == null) return;
//然后
switch (this.userType.SelectedItem.ToString())
{
...
}
tykao_cyj 2010-11-10
  • 打赏
  • 举报
回复
ListBox的选项值
tao1997 2010-11-10
  • 打赏
  • 举报
回复
listBox1.Items[listBox1.SelectedIndex]
userType是个什么东西?

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧