当控件是数据绑定时,无法以编程方式将行添加到DatagridView的行

时间:2016-11-20 11:24:22

标签: vb.net datagridview rows

我有这个代码将内容从一个DataGridView传输到另一个DataGridView

DailyRecordDataGridView.Columns.Clear()
    For Each Col As DataGridViewColumn In datagrid_log2.Columns
        DailyRecordDataGridView.Columns.Add(DirectCast(Col.Clone, DataGridViewColumn))
    Next
    For rowIndex As Integer = 0 To (datagrid_log2.Rows.Count - 1)
        DailyRecordDataGridView.Rows.Add(datagrid_log2.Rows(rowIndex).Cells.Cast(Of DataGridViewCell).Select(Function(c) c.Value).ToArray)
    Next

但它表明 "当控件是数据绑定时,行无法以编程方式添加到DataGridView"

0 个答案:

没有答案