Private networkAvailableEventHandler As NetworkAvailableEventHandler = AddressOf NetworkConnectionChanged

 Private Sub NetworkConnectionChanged(sender As Object, e As NetworkAvailableEventArgs)
        If Not disposed Then
            OnPropertyChanged("IsNetworkAvailable")
        End If
 End Sub

 Dim disposed As Boolean = False
    Public Overloads Sub Dispose() Implements IDisposable.Dispose
        Dispose(True)
        MyBase.Dispose()
        GC.SuppressFinalize(Me)
    End Sub

    Protected Overridable Overloads Sub Dispose(disposing As Boolean)
        If disposed = False Then
            If disposing Then
                RemoveHandler My.Computer.Network.NetworkAvailabilityChanged, networkAvailableEventHandler
                networkAvailableEventHandler = Nothing
                disposed = True
            End If
        End If
    End Sub

    Protected Overrides Sub Finalize()
        Dispose(False)
    End Sub

I have something close to above, my problem is, even after disposing the whole object the EventHandler invoke the NetworkConnectionChanged method even after removing the address.

any clues?

Here's how I'm handling things:

AddHandler Button1.Click, AddressOf NetworkConnectionChanged

Button1.Click could be remove with your event. And btw, AddHandler sometime doesn't work with Private Sub, use Sub instead might be safer.

This article has been dead for over six months. Start a new discussion instead.