Advanced Thread Question

ADO DOT NET

Centurion
Joined
Dec 20, 2006
Messages
160
Hi everyone:)
I have a thread question!
I use this code to start a thread:
Visual Basic:
        Dim Threads As New Thread(New ParameterizedThreadStart(AddressOf MyThread))
        Threads.Start()
And here is inside my thread:
Visual Basic:
    Private Sub MyThread(ByVal o As Object)
        ...
    End Sub
I want to know how can I CLOSE the form from inside thread?
Please help me as I am not very PRO in threads!
For example, I know to set the TEXT in a thread I should use this:
Visual Basic:
    Private Delegate Sub SetAccountsTextCallback(ByVal Message As String)
    Private Sub SetAccountsText(ByVal Message As String)
        On Error Resume Next
        If Me.AccountsProgressBarX.InvokeRequired Then
            Dim d As New SetAccountsTextCallback(AddressOf SetAccountsText)
            Me.Invoke(d, New Object() {Message})
        Else
            Me.AccountsProgressBarX.Text = Message
        End If
    End Sub
But cannot imagine how to close the form!
 
Ultimately you can't - you would need to get the thread to call back into the form and then have the form close itself using the same model you are using with the SetAccountsTextCallback.
 
Back
Top