Question

I gave in with finding data type that would fit following method:

  1. I have COM object method which requires "vector of BSTR strings" (as COM documentation says).

It works perfectly from: a) python (everything works from python BTW)

Visum.Net.Zones.GetmultipleAttributes(["No","Name","XCoord","YCoord","Name","SHAREPRTORIG","SHAREPRTDEST"])

b) VBS:

Visum.Net.Zones.GetmultipleAttributes(Array("No","Name","XCoord","YCoord","Name","SHAREPRTORIG","SHAREPRTDEST"))

c) but nothing can go with VB ('CComBaseContainer::GetMultipleAttributes failed' error is raised)

it tried such method Out=Visum.Net.Zones.GetmultipleAttributes(In) with following data types, everytime the same error:

Dim Out As Object
Dim In As New List(Of String)
Dim In(2) As String
In.toArray()

How can I satisfy this method?

PS. Quote from documentation:

GetMultipleAttributes ( [in] VARIANT AttrIDs, [out, retval] VARIANT *value)
Returns the values of several attributes for all net objects of the container. The attribute ID have to be specified as a vector of BSTR strings. The return value contains a matrix of VARIANT values consisting of the values of all objects and specified attributes. The rows of the matrix correspond to the net objects in standard order (ordered by their keys). The columns correspond to the attributes in the order as specified. Parameters [in] VARIANT AttrIDs Vectorof attribute IDs as in ATTRIBUTE.XLS. [out, retval] VARIANT *value Matrix of values of these attributes for all net objects in the container

Thanks in advance i2

Was it helpful?

Solution 2

The following finally worked, but don't ask me why:

    Dim In() As Object = {"No","Name","XCoord","YCoord","Name","SHAREPRTORIG","SHAREPRTDEST"}
    Dim VisumOut(,) As Object
    VisumOut = Visum.Net.Zones.GetMultipleAttributes(In)

After million of tries it finally went fine. If you know why is that, please give us proper answer.

Powodzenia, Rafał!

OTHER TIPS

If this works in VBS:

Visum.Net.Zones.GetmultipleAttributes(Array("No","Name","XCoord","YCoord","Name","SHAREPRTORIG","SHAREPRTDEST"))

The this should work in VB.NET:

Dim a() As String= New String() {"No", "Name", "XCoord","YCoord","Name","SHAREPRTORIG","SHAREPRTDEST"}

Visum.Net.Zones.GetmultipleAttributes(a) 'you might need a() instead

Have a look at this question for clarification: Equivalent of Array() in VB.NET?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top