Using OnPropertyChanged to replace On<Property>Changed

Posts   
 
    
JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 04-Jan-2007 12:34:06   

I have searched these forums, the help and even google and I can't seem to find any code samples or other help in the use of the OnPropertyChanged.

How and where should I define it so that it replaces functionality I had in old versions from code such as:

Protected Overrides Sub OnCreditLimitChanged()
    Call MyBase.OnCreditLimitChanged()
    CheckRules(Me)
End Sub

which appeared within the CustomEntityCode area of my entity.

Thanks

JMitchell avatar
JMitchell
User
Posts: 128
Joined: 01-Sep-2006
# Posted on: 04-Jan-2007 16:28:33   

Does this look right?

Protected Overrides Sub OnPropertyChanged(ByVal propertyName As String)
    Call MyBase.OnPropertyChanged(propertyName)
    If propertyName = "CreditLimit" Then
        CheckRules(Me)
    End If
End Sub
Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Jan-2007 16:53:26   

Yes. All you need to do is to use the overrides keyword, and to pass a string parameter.