如何动态地使用数据集弹出listview。 [英] how to poplate listview with dataset dynamically.

查看:75
本文介绍了如何动态地使用数据集弹出listview。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)我填充数据集。

然后我想以下列方式填写listview:

1) i fill the dataset.
Then i want to fill the listview in the following manner:

for i=0 to ds.columns.count-1
lv=new listviewitem
for j=0 to ds.row.count-1
lv.items.subitem(0)=ds.row("ID")
lv.items.subitem(0)=ds.row("Name")
lv.items.subitem(0)=ds.row("Fname")
next
lv.items.add()
next





但它给出的错误是位置0处的行



but it gives the error there is row at position 0

推荐答案





参考下面的代码

Hi,

Refer the below code
'Fill the dataset ds
        Dim lv As ListViewItem
        Dim i, j As Int16
        For i = 0 To ds.Tables(0).Rows.Count - 1 'Dataset have multiple tables, here I am reffering the first table
            lv = New ListViewItem

            lv.SubItems.Add(ds.Tables(0).Rows(i)("ID"))
            lv.SubItems.Add(ds.Tables(0).Rows(i)("Name"))
            lv.SubItems.Add(ds.Tables(0).Rows(i)("Fname"))

            ListView1.Items.Add(lv) 'Listview control
        Next





最好的问候

Muthuraja



Best Regards
Muthuraja


这篇关于如何动态地使用数据集弹出listview。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆