Error when using BackgroundWorker in Windows Service

I am running the following code as a windows service.  Or trying to.  I just need to have a couple of seperate threads running.  I usually do it with in a windows form with no problem, but when I try to compile this code, I get an error.    "Handles clause requres a WithEvents variable defined in the containing type or one of its base types"

Imports System.IO
Imports System.Diagnostics
Imports System.Text

Public Module modMain

    Dim BGW1 As New System.ComponentModel.BackgroundWorker

    Public Sub Main()


    End Sub

    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BGW1.DoWork

    End Sub

End Module
Who is Participating?
Dim WithEvents BGW1 As New System.ComponentModel.BackgroundWorker
billymcquearyAuthor Commented:
Wow, easiest 375 points ever.  Much thanks though, I'm off and running.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.