How to pass a Control to a Sub?
Posted on 2005-04-20
I have an ActiveX control that I can drag and drop onto a form. It has no way to create the object on the fly, rather it must be dragged and dropped onto the form. It is a third party object. I need 10 instances of this control, so I have dragged 10 of them on to my form. They are called x1, x2, x3, etc.
I now have set the various properties to values such as:
x1.Color = vbRed
x1.Speed = 1
x2.Color = vbBlack
x2.Speed = 5
How do I pass these objects to a function to set the properties? I want to do something like this:
Call SetProperties( x1, vbRed, 1 )
Call SetProperties( x2, vbBlack, 5)
Public Sub SetProperties( MyObj as Object) but it does not allow me to access the properties.
Public Sub SetProperties( MyObj as Control) but it does not allow me to access the properties either.