I have the following code that adds a background worker into a VB.net WPF project:
Imports System
Imports System.ComponentModel
Imports System.ComponentModel.BackgroundWorker
Imports System.IO
Imports System.Threading
Imports System.Net
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Navigation
Imports System.ServiceProcess
Partial Public Class Window1
Public Sub New()
MyBase.New()
Me.InitializeComponent()
End Sub
End Class
Public Class Window1
Dim worker As New BackgroundWorker
Private Sub worker_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.BackgroundWorker) Handles worker.DoWork
End Sub
End Class
And I get the following error for the DoWork worker event:
Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
It seems like it's missing something in the Event declaration, but can't find it.
Any ideas?