This project is read-only.

InvokeRequired RasConnectionEventArgs

Oct 23, 2010 at 11:51 PM


Could I ask what EventHandler to use when invoking?
EventHandler is not compatible with RasConnectionEventArgs:

Public Sub watcher_Connected(ByVal sender As Object, ByVal e As RasConnectionEventArgs) If InvokeRequired Then BeginInvoke(New EventHandler(AddressOf OnRegChanged)) Else TaskbarManager.Instance.SetOverlayIcon(My.Resources.LockIcon, "VPN Connected") Me.NotifyIcon.ShowBalloonTip(5000, "Connected", e.Connection.EntryName, ToolTipIcon.Info) End Sub

Oct 24, 2010 at 4:58 PM

The RasConnectionWatcher class is multi-threaded, as such you just need to set the SynchronizingObject property on the component. If you have the component on a form, you can set it to the form instance. It will handle the thread synchronization for you automatically once it's been set.

Oct 24, 2010 at 5:16 PM
Edited Oct 24, 2010 at 5:28 PM

Thanks for the reply.

watcher.SynchronizingObject = Me did the trick.