【发布时间】:2016-02-24 11:38:27
【问题描述】:
我不熟悉 .net 语言。但是我尝试将 datagridview 行复制到数据表中。当我在数据表上使用 Watch 时,它具有值,但是当我尝试观察数据集时,我的数据表为空。这是我的代码:
Dim dt As New DataTable("repTable")
For Each col As DataGridViewColumn In dgrMatchesExacutives.Columns
dt.Columns.Add(col.HeaderText)
Next
For Each row As DataGridViewRow In dgrMatchesExacutives.Rows
Dim dRow As DataRow = dt.NewRow()
For Each cell As DataGridViewCell In row.Cells
dRow(cell.ColumnIndex) = cell.Value
Next
dt.Rows.Add(dRow)
Next
If ds.Tables.Contains("repTable") Then
ds.Tables.Remove("repTable")
End If
ds.Tables.Add("repTable")
【问题讨论】:
标签: vb.net datagridview dataset