将列表添加到from上添加的listview控件。 [英] biding a list to a listview control added on a from.
本文介绍了将列表添加到from上添加的listview控件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好学院我hava方法返回一个列表,我想把这个列表绑定到我在表单上添加的listview控件。
foreach(Item m.AddItemToList中的项目(txtitemCode.Text))
{
listview1.additem(item)
}
但是这段代码不起作用,因为我无法获得listview的add方法
hello colleges i hava method which returns a list and i want to bind this list to a listview control that i have added on my form.
foreach(Item item in m.AddItemToList(txtitemCode.Text))
{
listview1.additem(item)
}
but this code is not working as i cant get the add method of the listview
推荐答案
这是你如何将项目添加到ListView
this is how you add a item to a ListView
foreach (var item in GetList(textBox1.Text))
{
//add item to the listview
listView1.Items.Add(item);
}
这篇关于将列表添加到from上添加的listview控件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文