我正在处理数据网格视图,将datagridview结果转换为excel我有这段代码:
For i = 0 To DG.RowCount - 2
For j = 0 To DG.ColumnCount - 1
For k As Integer = 1 To DG.Columns.Count
xlWorkSheet.Cells(1, k) = DG.Columns(k - 1).HeaderText
xlWorkSheet.Cells(i + 2, j + 1) = DG(j, i).Value.ToString()
Next
Next
Next
但如果我有另一种形式,而不是datagrid视图我有datagrid,但显示如下错误:
' Row不是system.windows.forms.datagrid'
的成员答案 0 :(得分:-1)
For IntJ = 0 To intGridRowCount - 1
d = "@" & dgDetails.Item(IntJ, 1).ToString
Next
试试这个。