Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
following Chip's suggestion to convert all my UDT to classes, I got into a stumbling block: how to deal with a dynamic array property? Suppose I have Private pYValues() As Double The Property Get should be trivial: Public Property Get YValues() As Double() YValues = pYValues End Property But how about the Property Let? I should handle the case of unallocated and allocated array, but I cannot test allocation of a dynamic array with Is Nothing. How can I get out of this? Thanks, Best Regards deltaquattro (Sergio Rossi) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can handle it like so
========= Class Module Private penalise() As Double Public Property Get YValues() As Double() YValues = pYValues End Property Public Property Let YValues(Values() As Double) pYValues = Values End Property ========= Standard Module Dim cls As Class1 Dim ary() As Double Set cls = New Class1 ReDim ary(1 To 3) ary(1) = 1 ary(2) = 2 ary(3) = 3 cls.YValues = ary ary = cls.YValues MsgBox ary(2) But as you can see, you effectively define and build the array in the calling procedure. -- HTH Bob "deltaquattro" wrote in message ... Hi all, following Chip's suggestion to convert all my UDT to classes, I got into a stumbling block: how to deal with a dynamic array property? Suppose I have Private pYValues() As Double The Property Get should be trivial: Public Property Get YValues() As Double() YValues = pYValues End Property But how about the Property Let? I should handle the case of unallocated and allocated array, but I cannot test allocation of a dynamic array with Is Nothing. How can I get out of this? Thanks, Best Regards deltaquattro (Sergio Rossi) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'K, thanks! It was simpler than I thought. I've coded that and, as
soon as I fix the other bugs in my code (see my new post :), I will let you know how it work. Best Regards Sergio Rossi On 15 Mar, 11:39, "Bob Phillips" wrote: You can handle it like so ========= Class Module Private penalise() As Double Public Property Get YValues() As Double() * * YValues = pYValues End Property Public Property Let YValues(Values() As Double) * * pYValues = Values End Property ========= Standard Module Dim cls As Class1 Dim ary() As Double * * Set cls = New Class1 * * ReDim ary(1 To 3) * * ary(1) = 1 * * ary(2) = 2 * * ary(3) = 3 * * cls.YValues = ary * * ary = cls.YValues * * MsgBox ary(2) But as you can see, you effectively define and build the array in the calling procedure. -- HTH Bob "deltaquattro" wrote in message ... Hi all, following Chip's suggestion to convert all my UDT to classes, I got into a stumbling block: how to deal with a dynamic array property? Suppose I have Private pYValues() As Double The Property Get should be trivial: Public Property Get YValues() As Double() * *YValues = pYValues End Property But how about the Property Let? I should handle the case of unallocated and allocated array, but I cannot test allocation of a dynamic array with Is Nothing. How can I get out of this? Thanks, Best Regards deltaquattro (Sergio Rossi) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Array Properties in a Class | Excel Programming | |||
Function in class module cannot be assigned an array? | Excel Programming | |||
How to modify fill handle properties? | Excel Discussion (Misc queries) | |||
Problems Setting properties of class module | Excel Programming | |||
Variable from a sheet module in a class module in XL XP | Excel Programming |