Sub FillListview_by_datatable(ByVal lvw As ListView,ByVal dt As DataTable) lvw.Clear For Each col As DataColumn In dt.Columns lvw.Columns.Add(col.ColumnName) Next For i = 0 to dt.Rows.Count -1 Dim lvwitem As ListViewItem = lvw.Items.Add(dt.Rows(i)(0)) For j = 1 to dt.Columns.Count -1 lvwitem.SubItems.Add(dt.Rows(i)(j).ToString) Next Next End Sub
No comments:
Post a Comment