Results 1 to 3 of 3

Thread: [RESOLVED] threading

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2017
    Posts
    147

    Resolved [RESOLVED] threading

    hi, i have a backgroundworker that performs a intensive process and at the end of the process i call a sub that i want to be executed back on the main thread

    Code:
        Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
       loop runs until  bla bla
    
    
    
    FishFingers() 'I want this sub to be executed back on the main thread  
      End Sub
    is this possible?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: threading

    You call RunWorkerAsync and the BackgroundWorker raises its DoWork event on a secondary thread. Once all handlers for the DoWork event have been executed, the BackgroundWorker raises its RunWorkerCompleted event on the UI thread. It's in a handler for that event that you would call your method. I suggest that you follow the CodeBank link in my signature below and check out my thread on Using The BackgroundWorker

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2017
    Posts
    147

    Re: threading

    thank you, that solved my problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width