Using gauges more effectively...

av8orfliboy

New member
Joined
Jul 25, 2007
Messages
4
Programming Experience
1-3
Again, the new programmer disclaimer... my understanding of processes and algorithms have got me in over my head with programming, hehe

Alright, I have a thread which continuously calculates the temperature of water in a tank. The user can change the heat input to the tank so the temperature is constantly changing based on a formula. In the thread I attempt to update gauge "temperature" on a form named "indication" with variable "temp".

(indication.temperature.value = temp).

Unfortunatly the gauge never displays the value of the temperature. Is this some limitation while using a thread.

I can update the gauge from anywhere else in the program and from any form, but not from that thread. I have tested the thread and it is working continuously, it just isn't displaying the value. Maybe there is a more efficient (or working) way to continuously update a gauge with a value??? Any help would be appreciated. Thanks.
 
You can't access controls created on different thread directly. Here's an example that display the thread-safe pattern (you must use one of the control's invoke methods to marshal the call to the proper thread) http://www.vbdotnetforums.com/showpost.php?p=60157&postcount=2
You could also use the BackgroundWorker for async operation, its Progress and Complete events are thread-safe. BW uses AsyncOperation and AsyncOperationManager from System.ComponentModel namespace to synchronize messages between threads.
 
Back
Top