Error when using BackgroundWorker in Windows Service

Posted on 2006-06-06
Last Modified: 2012-06-27
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
Question by:billymcqueary
    LVL 9

    Accepted Solution

    Dim WithEvents BGW1 As New System.ComponentModel.BackgroundWorker

    Author Comment

    Wow, easiest 375 points ever.  Much thanks though, I'm off and running.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    This video discusses moving either the default database or any database to a new volume.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now