How to dynamically create a background worker in VB.net

后端 未结 3 1686
谎友^
谎友^ 2020-12-18 17:32

I have a VB.net project which uses a background worker to do some stuff.

Now I want to expand the project to be able to do multiple stuff :)

A user can enter

3条回答
  •  醉话见心
    2020-12-18 17:51

    If I understand your question well, try declaring a BackgroundWorker in class level as:

    Friend WithEvents bgw1 As BackgroundWorker
    

    then in class constructor instantiate it.

    Public Sub New()
      bgw1 = New BackgroundWorker
    End Sub
    

    In class level declaration choose bgw1 and its event dropdown section choose DoWork, ProgressChanged and RunWorkerCompleted Events.

提交回复
热议问题