lindholm81
Programmer
- Apr 4, 2008
- 1
Hi!
I need your help guys. I wrote .NET application that uses COM-objects. I have imported tlb file of a library with such COM-objects into Visual Studio C#. Then Visual Stidio gave me classes of that COM-objects. There is my issue:
The one object has function EnableRules(string templName, ref object rules, bool enable).
In a COM-objects' API help there is a description of this function in VB code:
Method EnableRules (
templateName As String,
ruleIDs As Variant,
enable1 As Boolean
)
and an example
Dim rules() As Long
ReDim rules (1 To 2)
rules(1) = 18
rules(2) = 30
fr.BatchDocument.EnableRules "Test", rules, True
In my code I try such thing:
object rules = new long[2]{0,1};
fr.BatchDocument().EnableRules("Batch4", ref rules, true);
But it throws COMException like: impossible parameter value
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at FineForm.IFineFormBatchDoc.EnableRules(String templateName, Object& ruleIDs, Boolean enable1)
...
What is wrong in my code? Can you give me any advise?
Thanks
I need your help guys. I wrote .NET application that uses COM-objects. I have imported tlb file of a library with such COM-objects into Visual Studio C#. Then Visual Stidio gave me classes of that COM-objects. There is my issue:
The one object has function EnableRules(string templName, ref object rules, bool enable).
In a COM-objects' API help there is a description of this function in VB code:
Method EnableRules (
templateName As String,
ruleIDs As Variant,
enable1 As Boolean
)
and an example
Dim rules() As Long
ReDim rules (1 To 2)
rules(1) = 18
rules(2) = 30
fr.BatchDocument.EnableRules "Test", rules, True
In my code I try such thing:
object rules = new long[2]{0,1};
fr.BatchDocument().EnableRules("Batch4", ref rules, true);
But it throws COMException like: impossible parameter value
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at FineForm.IFineFormBatchDoc.EnableRules(String templateName, Object& ruleIDs, Boolean enable1)
...
What is wrong in my code? Can you give me any advise?
Thanks