If you have the code handy, that would be great...
This is code we have in one of our base forms for dumping the contents
of a datagrid to Excel. It works with the old style datagrids (.NET
FW1.1, VS 2003) and will work in FW 2.0. I don't know if it works with
the new datagrid object, but I'm sure it could be adapted. Hope this
helps:
Me.Cursor = Cursors.WaitCursor
Dim Excel As New Microsoft.Office.Interop.Excel.Application
Dim lcMappingName As String
Dim excelColumn As Integer, excelRow As Integer, colCtr As
Integer
excelColumn = 0
excelRow = 1
Excel.Application.Workbooks.Add(True)
Dim rowIndex As Integer
Dim GridTextColumn As DataGridTextBoxColumn
Dim GridBoolColumn As DataGridBoolColumn
For colCtr = 0 To
DataGrid1.TableStyles(0).GridColumnStyles.Count - 1
If
DataGrid1.TableStyles(0).GridColumnStyles(colCtr).GetType.ToString() =
"System.Windows.Forms.DataGridTextBoxColumn" Then
GridTextColumn =
DataGrid1.TableStyles(0).GridColumnStyles(colCtr)
lcMappingName = GridTextColumn.MappingName
Else
GridBoolColumn =
DataGrid1.TableStyles(0).GridColumnStyles(colCtr)
lcMappingName = GridBoolColumn.MappingName
End If
If
DataGrid1.TableStyles(0).GridColumnStyles.Item(lcMappingName).Width() >
0 Then
excelColumn += 1
Excel.Cells(1, excelColumn) =
DataGrid1.TableStyles(0).GridColumnStyles.Item(lcMappingName).HeaderText
rowIndex = 2
Dim row As DataRow
For Each row In DataSet1.Tables(0).Rows
rowIndex += 1
Excel.Cells(rowIndex, excelColumn) =
row(lcMappingName).ToString()
Next row
End If
Next
Me.Cursor = Cursors.Default
Excel.Visible = True