![]() |
Multi-level User Definet Types
Can you create a UDT with multiple levels of depth?
For example, if I had user defined type called house with the sublevels shown below, would I be able to dim House1 as house and have a multi-layered UDT so that I could call values like this House.MasterBedroom.Height or House.DiningRoom.Breadth? I'm not sure if this explains what I'm asking, but it's the best example I can think of. Below is the structure for the UDT that I am imagining. Is it possible to have a UDT that is more than one layer deep, with elements and sub-elements? House -MasterBedroom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -Guestroom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -LivingRoom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -DiningRoom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -Bathroom ---Breadth ---Depth ---Height ---Flooring ---PaintColour |
Multi-level User Definet Types
You would use two UDTs... one for the room type and another for the
properties; then you would declare the individual room types to be of the properties type. Here is an example... Private Type Properties Breadth As Double Depth As Double Height As Double Flooring As Long PaintColour As Long End Type Private Type Rooms MasterBedroom As Properties Guestroom As Properties LivingRoom As Properties DiningRoom As Properties Bathroom As Properties End Type You can now declare a variable to be of type Rooms and it will automatically possess the properties. For example, Dim MyRooms As Rooms MyRooms.Livingroom.Height = 8.25 Rick "steve" wrote in message ... Can you create a UDT with multiple levels of depth? For example, if I had user defined type called house with the sublevels shown below, would I be able to dim House1 as house and have a multi-layered UDT so that I could call values like this House.MasterBedroom.Height or House.DiningRoom.Breadth? I'm not sure if this explains what I'm asking, but it's the best example I can think of. Below is the structure for the UDT that I am imagining. Is it possible to have a UDT that is more than one layer deep, with elements and sub-elements? House -MasterBedroom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -Guestroom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -LivingRoom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -DiningRoom ---Breadth ---Depth ---Height ---Flooring ---PaintColour -Bathroom ---Breadth ---Depth ---Height ---Flooring ---PaintColour |
All times are GMT +1. The time now is 02:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com