如何从datatable填充listview [英] how to populate listview from datatable
本文介绍了如何从datatable填充listview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为dt的数据表,只有一列包含主题名称。我想用数据表填充列表视图。我过去用listareler填充了listview,但这次我想使用数据表。请帮忙。
解决方案
Dim list 作为 新 ImageList()
list.ImageSize = 新大小( 64 , 64 )
Dim i As Image = Bitmap.FromFile( product.png)
list.Images.Add(i)
listView1.LargeImageList = list
listView1.Items.Add( Java, 0 )
在For Each循环中添加最后一行
*叹气* ...搜索引擎(例如Google)真的可以成为你最好的朋友!
尝试这些链接 [ ^ ]
或者,很简单DataGridView1.DataSource = dt
i have a datatable called "dt" with only one column containing names of subjects. i want to populate a list view with the datatable. I have filled listview with datareaders in the past but this time i want to use the datatable. please help.
解决方案
Dim list As New ImageList() list.ImageSize = New Size(64, 64) Dim i As Image = Bitmap.FromFile("product.png") list.Images.Add(i) listView1.LargeImageList = list listView1.Items.Add("Java", 0)
Add Last line in For Each loop
*sigh* ... a search engine (e.g. Google) can really be your best friend!
Try one of these links[^]
Or, quite simplyDataGridView1.DataSource = dt
这篇关于如何从datatable填充listview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文