i am trying to import data from excel to datagrid view. why instead of actuel data "System.__ComObject" is displayed in datagrid cell.

 Dim xl As New excel.Application
            Dim xlsheet As excel.Worksheet
            Dim xlwbook As excel.Workbook

            xlwbook = xl.Workbooks.Open("d:\PayableInput\InvoiceUpload.xlsx")
            xlsheet = xlwbook.Sheets.Item(1)
            Dim Rowst As Integer = 0
            Dim RN As Integer = 1
            DgvInvoiceDetails.Rows.Clear()

            RN = 1

            Dim N As Integer = 0

            For N = 1 To 5
                DgvInvoiceDetails.Rows.Add()
                DgvInvoiceDetails.Item(0, N).Value = xlsheet.Cells(N, 1)

            Next



            xl.ActiveWorkbook.Close(False, "d:\PayableInput\InvoiceUpload.xlsx")
            xl.Quit()
            xlwbook = Nothing
            xl = Nothing



        thanks

Use the following code to add the rows and fill the data at the same time, this shall solve the problem:

For N = 1 To 5
DgvInvoiceDetails.Rows.Add(xlsheet.Cells(N, 1).value)
Next

This question has already been answered. Start a new discussion instead.