D
Derek Hart
On the main thread I have a status bar in a Windows form that I want to
update when a long database process runs. The database process runs on a
separate thread:
Dim t As New Thread(AddressOf SomeDatabaseProcess)
t.Start()
The database process will be called about 10 times in one long routine,
starting a new thread each time. But the problem is that I need the thread
to finish before code execution continues. The main reason this does not
just run on the same thread is that I need to get the darn status bar
updated, but the UI freezes up. I tried using t.Join() which does wait for
the thread to finish, but it does not allow the UI to be freed up. And I
tried setting a global variable to detect when the thread is done, but the
code after the thread just runs in a Do Loop until the variable is set,
which also freezes up the UI. Any ideas of how to get this working?
Derek
update when a long database process runs. The database process runs on a
separate thread:
Dim t As New Thread(AddressOf SomeDatabaseProcess)
t.Start()
The database process will be called about 10 times in one long routine,
starting a new thread each time. But the problem is that I need the thread
to finish before code execution continues. The main reason this does not
just run on the same thread is that I need to get the darn status bar
updated, but the UI freezes up. I tried using t.Join() which does wait for
the thread to finish, but it does not allow the UI to be freed up. And I
tried setting a global variable to detect when the thread is done, but the
code after the thread just runs in a Do Loop until the variable is set,
which also freezes up the UI. Any ideas of how to get this working?
Derek