Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UDT as class property type 2

Status
Not open for further replies.

combo

Technical User
Jan 1, 2003
4,191
PL
Hi,
Suppose I have UDT:

[tt]UDType
Enabled as Boolean
Value as Double
ObjValue as Object
End Type[/tt]

Having private UDType variable "iUDTypeVariable" in the class module to store values, is it possible (if so, how?) to define "UDTypeProperty" Property Let/Set and Get procedures, so that I can use:

[tt]MyClassObject.UDTypeProperty.Enabled=True
MyClassObject.UDTypeProperty.Value=3.1415926535
Set MyClassObject.UDTypeProperty=ObjVariable[/tt]

combo
 
I would change the UDT to a class with three properties. Then another class or client app can create instances of it via a method that has the three properties as parameters.

Paul Bent
Northwind IT Systems
 
Exposing a UDT as a property of a class isn't really possible, as UDT's are defined in .bas modules, and a class (which is really a COM object) can't expose a property made up of a non-COM datatype.

I would do as paulbent suggests and create a small class instead of using a UDT. Since it's a class, it's known to COM, and you'll be able to expose an instance of it via a property.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Thanks guys,
I was also thinking of extending visibility of UDT variable, but a new class seems to be much better solutions.
Thanks again for suggestion and explanation.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top