The class instance is nil unless you create a new instance of it.
So you’ve created a class called (well, I’m going to change it to the naming scheme I like) clsMotor.
When you use the motor class object you need to instantiate it for use:
dim oMotor1 as new clsMotor // the new keyword is what makes a new instance of the class to be used
oMotor1.sLocation = "Inside The Thing"
So now, the oMotor1 object has the value “Inside The Thing” in it’s sLocation property. You’d be able to breakpoint and see that in the debugger.
At the end of the method, the object instance would go out of scope, so you can store it as a property of the window to maintain the reference after the method finishes. Add a property to the window, call it oMotor2 and set it’s Type: to clsMotor
When you go to use the property on the window it is also nil until you give it an instance, so you can do something similar to the above (this also works if you want to create a new instance but reuse the variable name in the same method, but that can lead to bad variable naming confusion.)
oMotor2 = new clsMotor
oMotor2.sLocation = "Outside The Thing"
There’s a coffee cup metaphor that goes something like:
The class is the mold for the cup, it shows exactly how the instance should work and is the base framework for making the cup. The instance is the actual cup, you can fill it and use it; but first you have to make an instance by using the mold!
I hope this helps, and if you have any more questions feel free to ask!
Class types need to be instantiated with the NEW keyword before you can use them. Until they’re instantiated they are equal to Nil, which is why you get a NilObjectException.