In VB6, a UserControl can be compiled to an OCX and then included in another project as a referenced component. Alternately, the UserControl source itself (i.e., CTL file) can be included directly in an EXE or DLL project.
There is one curious difference between the two approaches. When used from an OCX, the list of Extender properties (more) is seamlessly merged with any custom properties defined for the control. But when used from a CTL this does not seem to be the case. Trying to use Extender properties on the control will generate compiler errors.
An example would be the .Tag
property. When referencing as an OCX this property is available in Intellisense and compiles OK. But when using the CTL, the exact same use of this property generates a compile-time error.
Other examples would be .Left
, .Top
, etc. I expected VB6 to treat the Extender properties the same regardless of how the control was included.
Why does this difference exist, and is there any fix?
(Note: As a workaround, I have been referring to the controls in code as type Object
when Extender properties need to be accessed. But ideally I would prefer to use the actual type for clarity and compile-time safety.)