将列表框项目绑定到文本框 [英] bind list box item to text box
本文介绍了将列表框项目绑定到文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不使用按钮单击事件的情况下将列表框项目绑定到Webform的文本框中?
How to bind list box item into text box in webform without using button click event??
推荐答案
您可以尝试以下操作:
You could try this:
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if ((sender as ListView).SelectedItems.Count>0)
{
textBox2.Text = (sender as ListView).SelectedItems[0].Text;
}
}
查看此链接:
使用C#进行Windows窗体编程-第10章:列表控件
WPF中的数据绑定
Check out this link :
Windows Forms Programming with C# - Chapter 10: List Controls
Data Binding in WPF
这篇关于将列表框项目绑定到文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文