Problem in COM Callable Wrapper
i am creating a CCW and use it in VB 6.0 application. I have created two classes, ClassA and ClassB in .NET wrapper.
I am able to get the methods and properties of these classes in VB 6.0. My problem is that I am trying to create an array of object of classA in vb 6.0 and trying to pass this array in one of the method of ClassB. But I am getting runtime error.
Error Message displayed is:
----------------------------
Run-time Error '5':
Invalid procedure call or argument
----------------------------
Here is the VB code,
Dim objB As New wrapperCls.ClassB
Dim objA As New wrapperCls.ClassA
Dim arrObjA(1) As New wrapperCls.ClassA
objA.CurveName = "Curve1"
objA.Date = "12122007"
objA.DeliveryPeriod = "2"
objA.DeltaPosition = 32.232
objA.GammaPosition = 4.34
objA.Peakness = "3"
objA.RiskType = "Low"
objA.TimePeriod = 2
objA.uOM = "MMBTU"
objA.uOM = "UMB"
Set arrObjA(0) = objA
objB.CorrectionNeeded = True
objB.Counter = 2
objB.DiscountNeeded = True
objB.Method = "SampleMEthod"
objB.NodeId = 3
objB.UserId = "Bhupi"
objB.VolNeeded = True
objB.getPositionDataVO adPDataArr ''' error occurs at this line
.NET CODE
===========
/** Interface declaration **/
[Guid("CDD5E142-1CC1-4a76-A9E6-A415E2C41FD0")]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface _ClassB
{
[DispId(21)]
bool CorrectionNeeded{get;set;}
[DispId(22)]
int Counter{get;set;}
[DispId(23)]
bool DiscountNeeded{get;set;}
[DispId(24)]
string Method{get;set;}
[DispId(25)]
int NodeId{get;set;}
[DispId(27)]
string UserId{get;set;}
[DispId(28)]
bool VolNeeded{get;set;}
[DispId(29)]
void getPositionDataVO(ref AdhocPositionDataVO_Wr[] arrPDV);
}
/** Class B **/
[Guid("1FA539FE-DE70-4e4e-B598-74BA2DA41447")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("AdHocVar.AdhocInputMessageVO")]
public class AdhocInputMessageVO_Wr: _AdhocInputMessageVO_Wr
{
public AdhocInputMessageVO_Wr() {}
private bool _CorrectionNeeded;
private int _Counter;
private bool _DiscountNeeded;
private string _Method;
private int _NodeId;
private AdhocPositionDataVO_Wr[] _PositionDataArray;
private string _UserId;
private bool _VolNeeded;
private AdhocPositionDataVO_Wr _PosData;
public bool CorrectionNeeded
{
get{return this._CorrectionNeeded;}
set{this._CorrectionNeeded =value;}
}
public int Counter
{
get{return this._Counter;}
set{this._Counter=value;}
}
public bool DiscountNeeded
{
get{return this._DiscountNeeded;}
set{this._DiscountNeeded=value;}
}
public string Method
{
get{return this._Method;}
set{this._Method=value;}
}
public int NodeId
{
get{return this._NodeId;}
set{this._NodeId=value;}
}
public string UserId
{
get{return this._UserId;}
set{this._UserId=value;}
}
public bool VolNeeded
{
get{return this._VolNeeded;}
set{this._VolNeeded=value;}
}
public void getPositionDataVO(ref AdhocPositionDataVO_Wr[] arrPDV)
{
this._PositionDataArray = arrPDV;
}
}
any reply will be highly appreciated.....
Thanks,