Hi,
I'm using a COM object which has a method with 5 arguments, 3 of them being optional (below).
---------------
COM Object method
objLibrary.CreateObject(ObjType, ClassIdent, [Option], [OptionEx1], [OptionEx2])
Parameters:
ObjType - idmObjectType
ClassIdent - Variant.
Option - Optional. Variant.
OptionEx1 - Optional. Variant.
OptionEx2 - Optional. Variant. Not implemented.
---------------
My code:
IDMObjects.Document objDoc;
objDoc = (IDMObjects.Document) (objLibrary.CreateObject(IDMObjects.idmObjectType.idmObjTypeDocument, objClsDesc, variant1, variant2, variant3));
-------------------In VB and C++, I can ignore the 3 optional arguments ie. CreateObject( arg1, arg2), but in C#.NET I need to supply 5 arguments. I tried putting null, empty string, zero into the optional arguments (variant1, variant2, variant3) but I keep on getting "Bad Variable" error.
I also tried declaring a variable of type Object:
Object variant1 = new Object()
and feed that into the optional arguments, but didn't work either.
Could anyone please help me?
Thank you so much in advanced.
Regards,
Tina
Replies
Know the answer? Post it — somebody with the same question will find it here.