Monitoring for changes?

Mr60s

New member
Joined
Jan 14, 2008
Messages
2
Programming Experience
1-3
Hi there!

I just signed up here and was hopeing for some help.

I was wondering if its possible to monitor lets say a variable for changes.

If i got this variable or whatever:
Dim Test as integer = 1

When Test changes to let's say 2, I want to execute some peace of code.

How could I manage to do this?
 
I was wondering if its possible to monitor lets say a variable for changes.
It is not. You can write a property and manage monitoring in the setter:
VB.NET:
Public Event NewPropertyChanged As EventHandler

Private newPropertyValue As Integer
Public Property NewProperty() As Integer
    Get
        Return newPropertyValue
    End Get
    Set(ByVal value As Integer)
        newPropertyValue = value
        RaiseEvent NewPropertyChanged(Me, New EventArgs)
    End Set
End Property
 
Back
Top