Click to See Complete Forum and Search --> : OCX property(let) with string array as parameter


Alexander Kempf
April 11th, 2001, 04:27 AM
Hi all,

I'm trying to create an OCX with a property
which is of the type String(). It looks like
this:

public property let myProp(p() as string)
public property get myProp() as string()



When compiling everything seems fine. But
when the program calls the property(let)
the parameter p() is not initialized. So
when calling the UBound(p)-function an
error is raised. What is wrong about the
property? Any ideas anyone?

Thanks in advance,

Alexander Kempf

James Longstreet
April 11th, 2001, 08:27 AM
The property should be declared as a variant.
Arrays are handled differnely between programming languages, so COM passes all arrays as variants.

Question is are you using this code from C++ eventually?



Jim Hewitt
Software Developer
Liberty Tax Service
www.LibertyTax.com

Alexander Kempf
April 11th, 2001, 08:37 AM
So you say I should declare the property as


public property let myProp(p as Variant)
public property get myProp() as Variant




Is that what you meant? I already tried it
with an variant array which also refused to work.

To answer your question about using the OCX from
C++: No, not yet.

Thanks,

Alexander Kempf

James Longstreet
April 11th, 2001, 08:40 AM
Yes, declare it as a variant.

If you want to use the property from VB you can just pass the array and VB should convert it to a variant in the transfer.

When doing it in C++ you will have a harder time because you have to pass it as a safearray, is the only reason I was asking about c++.

thanks

Jim Hewitt
Software Developer
Liberty Tax Service
www.LibertyTax.com