The mechanism for raising events in VB.NET is child's play. Here's a generic example:
VB Code:
Public Class Class1
'A private field to store the value.
Private myVar As Object
'A public property to expose the value.
Public Property MyProperty() As Object
Get
Return Me.myVar
End Get
Set(ByVal value As Object)
If value IsNot Me.myVar Then
'The new value is different so set the field and raise the event.
Me.myVar = value
Me.OnMyPropertyChanged(EventArgs.Empty)
End If
End Set
End Property
'A public event to indicate that the property value has changed.
'Note that the event name is the property name with a "Changed" suffix.
Public Event MyPropertyChanged(ByVal sender As Object, ByVal e As EventArgs)
'A protected method to raise the event.
'Note that the method name is the event name with an "On" prefix.
Protected Sub OnMyPropertyChanged(ByVal e As EventArgs)
RaiseEvent MyPropertyChanged(Me, e)
End Sub
End Class
Events don't have to be linked to a specific property value changing but they commonly are.
If the methods that will handle your event need to receive data about it then you would use a type derived from EventArgs instead of an EventArgs object. You can use an existing type if it suits or declare your own. In that case you would create a new instance in the property setter and pass it to the method that raises the event.