1、listbox怎样添加value值?
2、listbox怎样取出任意一行的text和value 值?
期待您的解答!!
2、listbox怎样取出任意一行的text和value 值?
期待您的解答!!
解决方案 »
- .net中,我在aspx.cx页面写了个执行sql语句方法,在该方法里,我想在finally中释放sqlconnection连接,
- UltraWebGrid 中CheckBox单选问题
- 邮件问题!!连接密码不正确!
- 如何通过ClickOnce部署让windows应用程序能够通过网络访问?
- 提示更新成功,为何数据库数据没更新
- 用正则表达式得到两个字符串之间的内容
- 请教一个简单的正则表达式问题,用于html解析
- 如何阻止用户修改textBox中的文本?
- 怎么确定函数,在内存中的地址?
- Socket截获本机数据包问题
- 不知道是什么问题
- Hashtable与Arrylist有什么区别?????????????---------在线等待
2.this.listBox1.SelectedItem.ToString();
2>
ListBox1.SelectedItem.Text;
ListBox1.SelectedItem.Value; //单选可以用如果是多选的话用foreach循环来获得选定选的值!
this.listBox1.Items[任意行索引].ToString(); ???
没有这样的方法!!
this.listBox1.Items[任意行索引].Text.ToString();
this.listBox1.Items[任意行索引].Value.ToString();
当然是winform,web哪会有LIstbox
to xczgb(民工乐园) :
当然是winform,web哪会有LIstboxweb 当然有listbox,拜托,看来大家都是半调子,哈哈
在winform里有“this.listBox1.Items[任意行索引].Text.ToString()”这样的?????
在winform里有“this.listBox1.Items[任意行索引].Text.ToString()”这样的?????我说了“而且我的方法在web下是可行的,只是你没说清是web还是winform吧了
”
xczgb(民工乐园)你的眼睛怎么看的哦
{
for(int i=0;i<10;i++)
{
Item obj =new Item();
obj.strText ="显示文本"+i.ToString();
obj.strValue =i.ToString();
this.listBox1.Items.Add(obj);
}
} private void button3_Click(object sender, System.EventArgs e)
{
Item obj =this.listBox1.SelectedItem as Item;
if(obj!=null)
{
MessageBox.Show("Text:"+obj.strText+" 值:"+obj.strValue);
}
}
}
public class Item
{
public string strText;
public string strValue;
public override string ToString()
{
return this.strText;
} }