ADO DOT NET Posted February 21, 2008 Posted February 21, 2008 Hi everyone:) I have a thread question! I use this code to start a thread: Dim Threads As New Thread(New ParameterizedThreadStart(AddressOf MyThread)) Threads.Start() And here is inside my thread: 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: 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! Quote
Administrators PlausiblyDamp Posted February 21, 2008 Administrators Posted February 21, 2008 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.