troubleshooting Question

backgroundworker VB.NET

Avatar of fernandovitale
fernandovitaleFlag for Argentina asked on
Visual Basic.NET
3 Comments1 Solution585 ViewsLast Modified:
I have this code:

Public Class Form1

    Private SW As New Stopwatch

    Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        BackgroundWorker1.WorkerReportsProgress = True
    End Sub

    Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
        While True
            BackgroundWorker1.ReportProgress(-1, SW.Elapsed.Minutes.ToString("00") & ":" & SW.Elapsed.Seconds.ToString("00"))
        End While
    End Sub

    Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs) Handles BackgroundWorker1.ProgressChanged
        Label1.Text = e.UserState.ToString
    End Sub

End Class

The BackgroundWorker starts when my application executes a SQL query, But the clock remains frozen until the query ends ... want the timer to continue running while the query is executed, how can i do this?

 thank you very much
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros