COM & VB.NET overloading
-
Hi, I'm working on a VB.NET project and my objects should be reachable using COM. My problem is that these objects have overloaded methods, properties, which seems problematic. For example I have a collection class with two item properties:
Default Public ReadOnly Property Item(ByVal Key As String) As Object
andDefault Public ReadOnly Property Item(ByVal Index As Integer) As Object
When I try to use an object of this class in a COM only environment - like MS Word - there only one Item can be seen, and allways the first. So using the order above I can query collection items only by Key, when I change the order I can query only by Index. This problem does not occour under .NET. My question is: how to do VB.NET overriding, polymorphism to satisfy COM requirements? (K) (K) -
Hi, I'm working on a VB.NET project and my objects should be reachable using COM. My problem is that these objects have overloaded methods, properties, which seems problematic. For example I have a collection class with two item properties:
Default Public ReadOnly Property Item(ByVal Key As String) As Object
andDefault Public ReadOnly Property Item(ByVal Index As Integer) As Object
When I try to use an object of this class in a COM only environment - like MS Word - there only one Item can be seen, and allways the first. So using the order above I can query collection items only by Key, when I change the order I can query only by Index. This problem does not occour under .NET. My question is: how to do VB.NET overriding, polymorphism to satisfy COM requirements? (K) (K)Because overloading isn't supported in COM, hence a COM-Callable Wrapper (CCW) can't be created properly. Choose one or the other, but not both.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Hi, I'm working on a VB.NET project and my objects should be reachable using COM. My problem is that these objects have overloaded methods, properties, which seems problematic. For example I have a collection class with two item properties:
Default Public ReadOnly Property Item(ByVal Key As String) As Object
andDefault Public ReadOnly Property Item(ByVal Index As Integer) As Object
When I try to use an object of this class in a COM only environment - like MS Word - there only one Item can be seen, and allways the first. So using the order above I can query collection items only by Key, when I change the order I can query only by Index. This problem does not occour under .NET. My question is: how to do VB.NET overriding, polymorphism to satisfy COM requirements? (K) (K)What's the VARIANT equivalent type? -- You're entertaining at least.
-
What's the VARIANT equivalent type? -- You're entertaining at least.
-
Is this always true: object <=> VARIANT? :~ -- I am perpetual, I keep the country clean.
-
Is this always true: object <=> VARIANT? :~ -- I am perpetual, I keep the country clean.
If you don't know what type, and specify none, the default is Object, in non-.NET VB (:-)) that was Variant. However, do not convert "As Any" in API declaratioins to "As Object", because you'll get an error like "not set to an instance of an object"..., use the most convenient type instead, if you are using more of them, define different functions referring to the same alias ;-) greetz ;-) *Niels Penneman*
Software/Dev Site
Personal Site