I’m trying to create a global array of Class ‘Ring’. After some reading, I’ve done the following (all in the same Module).
- created a class ‘Ring’ with several properties (e.g. insideDiameter, outsideDiameter).
- create a (global) property called Rings() of type Ring.
- created a method that populates Rings() by declaring a private variable TempRing of type Ring. Once tempRing is computed I append this to Rings() with Rings.AddRow(TempRing).
Compiles and runs fine. I can add rows without issue. But all of the rows are of the same value … the last value I add. Seems every Addrow is overwriting all of the rows with the same data.
I’ve tried numerous ways to declare things differently and none of those will even compile. I note when I’m trying to do the exact same thing without the need for an array, I need the statement myRing = new Ring’ in code. But I’ve been unable to come up with the array version of this.
What am I doing wrong? Thank you.