What to pass in place of omitted parameters in C#

Add-in Express™ Support Service
That's what is more important than anything else

What to pass in place of omitted parameters in C#
 
M D




Posts: 11
Joined: 2007-03-29
Hi,

I'm stuck with this simple call:

object o = workbook.Worksheets.Add( null, null, 1, XlSheetType.xlWorksheet );

Always get exception from HRESULT 0x800A03EC. I suspect it might have something to do with those null's passed in place of optional parameters. Is it OK to pass null where you don't want to specify a value or is there some predefined constant for this, something like "missing" or "empty" whatever?

Thanks for reply, md.
Posted 13 May, 2007 16:57:30 Top
David Ing




Posts: 39
Joined: 2007-02-16
http://msdn2.microsoft.com/en-us/library/system.reflection.missing.aspx

as in:

using System.Reflection;

object missing = Missing.Value;
object o = workbook.Worksheets.Add( missing , missing , 1, XlSheetType.xlWorksheet );
Posted 13 May, 2007 23:29:10 Top
M D




Posts: 11
Joined: 2007-03-29
That's it. Thanks very much.
Posted 14 May, 2007 08:05:17 Top