System.Runtime.InteropServices

May 4 2005 3:27 PM
Hi Guys I have been banging my head against the wall for some time.Please Help... I have downloaded an example in C#.NET and have made some conversion that have worked in my C++.NET winform application. Does anyone have any ideas? The last line does not work....... // get the collection of sheets in the workbook //C# example // Excel.Sheets sheets = theWorkbook.Worksheets; // This conversion works Interop::Excel::Sheets *sheets = theWorkbook->Worksheets; //C# example // Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1); // This does not work..it is looking for a // error C2664: 'Interop::Excel::Sheets::get_Item' : cannot convert parameter 1 from 'int' // to 'System::Object __gc *' Interop::Excel::Worksheet *worksheet = (Interop::Excel::Worksheet*)sheets->get_Item(1);

Answers (1)