calling ThreadManager.StopAllExecutingThreads() when opening new form


Author
Message
Marcel Heitlager
Marcel Heitlager
StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)StrataFrame User (202 reputation)
Group: StrataFrame Users
Posts: 84, Visits: 835
When my main mdi form opens I use the threadmanager to asynchronously retrieve some status information from the database to display on the form.
If the task in the main form isn't completed and I tell the threadmanager in the main form form to StopAllExecutingThreads(), I can't  make any remote database calls through es in the child form. The child form also has a threadmanager, but synchronous calls don't work either.

In the main form I call in the load event:
        Me.AESPPMMainThreadManager.AddProcess(AddressOf WebSiteDataModificationsReporter.GetEnrollmentStatus, "tdEnrollmentStatus")
        Me.AESPPMMainThreadManager.AddProcess(AddressOf WebSiteDataModificationsReporter.GetOnePayTransactionUpdates, "tdOnePayTransactions")

then in the click event of the button that opens the child form:
  
 Private Sub tsbDataManagement_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbDataManagement.Click
        If Me.CheckPermission("Export Data") Or Me.CheckPermission("Import Data") Then
            Me.AESPPMMainThreadManager.StopAllExecutingThreads()
            Me.LoadForm(GetType(AESPPM.Main))
        End If
   End Sub

Then in the load event of the child form:

            Me.ThreadManager1.AddProcess(AddressOf WebSiteDataModificationsReporter.GetEnrollmentStatus, "tdEnrollmentStatus")
            Me.ThreadManager1.AddProcess(AddressOf WebSiteDataModificationsReporter.GetOnePayTransactionUpdates, "tdOnePayTransactions")

Basically it's calling the same methods again, retrieving the same data (checking to see if it has updated).
Once the call in the parent form has aborted, however,  the child form can't access the internet at all whether through sync or async calls.

What might I be missing?

Thanks,

Marcel

Edited 13 Years Ago by Marcel Heitlager
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search