Your technology certification is waiting. Enroll in Cloud Class ®
'At form level:
Private _myThread As Thread = Nothing
Private _myVariable As String = String.Empty
'When you want to start your thread
_myThread = New Thread(AddressOf MiThreadSub)
Application.DoEvents() 'Or, better, check for your thread alive status into a timer
'Once outside of the while...end while, your thread has finished
'Now you can check your _myVariable status and put it into a label or wherever you want
Me.Label1.Text = _myVariable
'What your thread does:
Private Sub MiThreadSub()
'... do something
'If the thread is executing inside a Windows Form, you cannot access Form objects
'such as labels, etc.
'But you can store values into form variables
_myVariable = "Hello"
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.