I have a property-only class defined as DayClass.
I create a property of WindowX, MyDayClass() as DayClass.
I try to do in the window’s open event:
MyDayClass(-1) as new DayClass
Then, when I know what the dimension needs to be:
Redim WindowX.MyDayClass(DayCount -1)
The compiler seems happy with it all BUT …
An Out of Bounds exception is generated with the new statement.
I also try
WindowX.MyDayClass(DayCount-1) as new DayClass
If I simply do (without the new)
Redim WindowX.MyDayClass(DayCount - 1)
It is executed without complaint BUT a later reference to WindowX.MyDayClass(index).AProperty
generates a Nil Object exception. When I inspect the contents of WindowX.MyDayClass I see six “rows” (the dimension is 6 in the example that was run) and the rows are all nil.
So, what is the correct incantation for creating an array of classes? My earlier effort used an array of structs but string handling, was, shall we say, painful! But, I COULD create a run-time dimensioned array of structs as I tried with a class in the first try, above.
As a painful fall-back, I COULD create an independent array for each property of DayCass, but it seems much more sensible to handle them ensemble.
Oregon Research Electronics