Skip to content

Instantly share code, notes, and snippets.

@AnthonyDGreen
Last active March 7, 2019 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnthonyDGreen/a4fa8cfc17373c6021df8b30d7436123 to your computer and use it in GitHub Desktop.
Save AnthonyDGreen/a4fa8cfc17373c6021df8b30d7436123 to your computer and use it in GitHub Desktop.
Imports System.ComponentModel
Class BindableRange
Implements INotifyPropertyChanged
Private _EndDate As Date?
Property EndDate As Date?
Get
Return _EndDate
End Get
Set(value As Date?)
' This line here:
If value = _EndDate Then Return
_EndDate = value
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(NameOf(EndDate)))
End Set
End Property
Public Event PropertyChanged As PropertyChangedEventHandler _
Implements INotifyPropertyChanged.PropertyChanged
End Class
Module Program
WithEvents Range As New BindableRange
Sub Main()
Range.EndDate = Today
Range.EndDate = Today
Range.EndDate = Nothing
Range.EndDate = Nothing
End Sub
Private Sub BindableRange_PropertyChanged(sender As Object, e As PropertyChangedEventArgs) _
Handles Range.PropertyChanged
Console.WriteLine(e.PropertyName & " changed.")
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment