ActiveX Control Tutorial - Part 4
Behind virtually all of our Property Let routines, you will notice the wizard added a strange 'PropertyChanged' statement, as so:
Public Property Let ConvertCase(ByVal _New_ConvertCase As CaseType) m_ConvertCase = New_ConvertCase PropertyChanged "ConvertCase"End Property
Why? Well, this is very simple. And I'm not talking about 'E=mc2' simple here. I'm taking more along the lines of '1=1' simple.
All PropertyChanged does is inform the thing using your control that a particular property has changed. In other words:
PropertyChanged "ConvertCase"
...would send a message back to Visual Basic saying, "Hey, somebody has altered ConvertCase so make sure the Properties window is up-to-date. Oh, and don't forget that 'cause a change has been made, you'll probably want to save the project some time soon!"
Once again, the Wizard has automatically added all this for you. If you need to do it for yourself however, use this format:
Public Property Let PropName(ByVal _vNewValue As Variant) ' Usual code for processing property goes here PropertyChanged PropNameEnd Property
Page 4 of 8
This article was originally published on November 22, 2002