T
Tony Johansson
Hi!
Below I have two code snippets the first one is done in VB and the second is
done in C#.
I do know why the C# version is getting compile error because I have
discussed that issue in a thread before.
But how can the VB version work without passing any parameter ?
I mean the underlaying Dll that is being called from VB is the same as the
one that is called from C# and
to have this statement NewExcelApp.Worksheets.Add();
in C# gave compile error.
So what I don't understand is how the support for Optional parameter that VB
has make it work ?
Here I have one VB code snippet.
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Excel
Dim NewExcelApp As New Microsoft.Office.Interop.Excel.Application
'This works fine
NewExcelApp.Worksheets.Add()
//C#
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Excel; //Must have Office installed
Application NewExcelApp = new Application();
//This will not compile
NewExcelApp.Worksheets.Add();
//Tony
Below I have two code snippets the first one is done in VB and the second is
done in C#.
I do know why the C# version is getting compile error because I have
discussed that issue in a thread before.
But how can the VB version work without passing any parameter ?
I mean the underlaying Dll that is being called from VB is the same as the
one that is called from C# and
to have this statement NewExcelApp.Worksheets.Add();
in C# gave compile error.
So what I don't understand is how the support for Optional parameter that VB
has make it work ?
Here I have one VB code snippet.
Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop.Excel
Dim NewExcelApp As New Microsoft.Office.Interop.Excel.Application
'This works fine
NewExcelApp.Worksheets.Add()
//C#
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Excel; //Must have Office installed
Application NewExcelApp = new Application();
//This will not compile
NewExcelApp.Worksheets.Add();
//Tony