Dear forum members,
i a m trying to export the contents of datagrid to excel but i am facing errors.After searching i have seen that the problems occurs because one of my columns is of type TIME and taht is why i am getting the error : Object reference not set to an instance of an object.
Is there a way to solve this problem withount havineg to mess up my database?
For i = 1 To Me.DataGridView7.RowCount
.cells(i, 1) = Me.DataGridView7.Rows(i - 1).Cells("name").Value.ToString
For j = 1 To DataGridView7.Columns.Count - 1
.cells(i, j + 1) = DataGridView7.Rows(i - 1).Cells(j).Value.ToString
Next
Next
For j = 1 To DataGridView7.Columns.Count
.columns(j).EntireColumn.AutoFit()
Next
End With