Iam trying to create an excel file with the info within the datagridview which I get from a db. but I get the following error Exception from HRESULT: 0x800A03EC" (System.Runtime.InteropServices.COMException)... the error seems to be in the line with **
the code is within a button click
Microsoft.Office.Interop.Excel.Application excel1 = new Microsoft.Office.Interop.Excel.Application { };
Workbook work1 = excel1.Workbooks.Add(XlSheetType.xlWorksheet);
Worksheet ws1 = (Worksheet)excel1.ActiveSheet;
excel1.Visible = true;
ws1.Cells[1,1] = "ID";
ws1.Cells[1,2]= "NAME";
** ws1.Cells[1,1]= dataGridView1[1,1];
ws1.Cells[1, 2] = dataGridView1[1,2];