The Procedure Attributes dialog includes a Procedure ID combo box, that lets you associate a particular ID to a given member of the class. You usually use this combo to make a property or a method the default item of a class or an ActiveX control, but there are other uses as well. For instance, you may want to associate a Text property to the Text attribute, or a Caption property with the Caption attribute. This is necessary to have these properties behave like they do in standard VB controls: when the user enters a new value in the Property Window, the new value appears immediately in the control, as he or she types each key.
It is not infrequent that you want to combine these attributes with the default ID: if you are writing an enhanced textbox control, for example, its Text property will be also the default property of the control. It is evident that you can’t select two IDs for the same property, and you have to resort to the following trick.
Define the Text or Caption property as always, and assign it the corresponding attribute. Then define a new property and make it hidden. This new property – whose name is not really important, because it won’t be seen by the user – just delegates to the actual property. For example, you can use a property name that includes a trailing underscore:
Property Get Text_() As String Text_ = TextEnd PropertyProperty Let Text_(newValue As String) Text = newValueEnd Property