在vb.net中按列在Listview中插入数据

时间:2014-02-14 08:25:34

标签: vb.net listview

通常我们将数据插入Listview by Row。例如

No.  Item  Price   Status  Date
 1.   A     9.90    Pass   1/1/14
 2.   B     10.00   Pass   3/1/14
 3.   C     11.00   Failed 4/2/14

但我确实想按列添加数据。例如

No.  Desc   1/1/14   3/1/14   4/2/14
 1.  Item      A        B         C
 2.  Price    9.90    10.00    11.00
 3.  Status  Pass    Pass      Failed

我不知道如何启动这个逻辑。我希望有人能帮助我。 谢谢。

1 个答案:

答案 0 :(得分:0)

        ListView1.DataSource = myData.Tables["Customers"]; 'DataSet and DataTable name
        ListView1.DataTextField = "CustomerName"; 'Column you want to show
        ListView1.DataValueField = "CustomerId"; 'Value
        ListView1.DataBind();