-
I'm trying to write a Class Module that will work in a For Each Loop, ie
Code:
Dim objMyClass as New clsMyClass
Dim i as Variant
For Each i in objMyClass
MsgBox i
Next i
It's not a normal collection type thing (Actually I want it to define an elipse and the For each loop to go through every pixel on the border of that ellipse) How can I get this to work without having to have a collection inside my class (Filling a collection with all the points would be a huge waste of memory) I don't mind a bit of V-Table jiggery Pokery, any hints at all would be great.
-
AFAIK, For each just works with objects, so you need to put a second object of another class to act as that object. Then have the items all refering to the same object, with property get/set
But for this i would use for next instead and have the points in a simple property get/let to calculate the points, but i don't know if you actually need it to be an object.
-
For each... only works with collections.
Try it out with the classbuilder wizard, create a collection class, and a class of the type you created the collection for. The wizard automatically adds code for a for each loop
-
Not really, you can use with variable arrays too, we've discussed this out so don't bother anymore
-
you could do the math. I have it at home if you don't mind waiting about 8 hours till school's out. It's using the sin of the x and y to PSet a point on the picture box (you have to add stuff like (this is off the top of my head, here):
Code:
For i = 1 to 360 step .1
x = 2000+(300 * Sin (500 * i))
y = 2000+(150 * Sin (500 * i))
Next i
bob