
Passing array from VB to VC++
I am not sure (have not done VB in a while) but,
dim var as VARIANT
var = list
Set SCSet = SCSets.Add("set1", stPoint, sotList, var)
your list looks more like SAFEARRAY(int), not a VARIANT. I do not know if VB
will convert behind the scenes for you. Did you ever get into C++ method?
"Type Mistmach" can be caused by failing QI when Set is done.
-vlad
Quote:
> Hello -
> I have a Server written in VC++ which contains a collection
> called Sets. I'm having trouble using the Add method.
> Type library definition:
> [id(3)]
> HRESULT Add([in] BSTR name, [in]SetObjectType type, [in]SetOptionType
> otype, [in]VARIANT list, [out, retval]_IDualSetItem** prop);
> Note: SetObjectType and SetOptionType are enums.
> list is meant to hold a SAFEARRAY.
> VB code:
> Dim list(1 To 2) As Integer
> Dim SCSets As MyApp.Sets
> Dim SCSet As MyApp.Set
> Set SCSets = MyApp.Sets
> list(1) = 2
> list(2) = 4
> Set SCSet = SCSets.Add("set1", stPoint, sotList, list)
> The above line generates Run-time error 13 "Type mismatch error".
> I suspect it is because of the array. What's the correct method for
> passing an array?
> Thanks,
> Drew