Monitoring a Variable [VB.net 2008]
Hi
I am trying to make a program the will monitor if the certain variable changes.
lets say if the default value is 0, the program will just listen, but when the value changes to 1. something will happen.
here is what i have thought
Code:
Do Until Exit_button is clicked
If val != 0 Then
Execute Statement
End if
Loop
how can i do this? in VB.net if its just that, the program wont let me do anything. since it is busy with the endless loop.
thanks
Re: Monitoring a Variable [VB.net 2008]
The UI is handled by a seperate thread, so you have to either have
Code:
application.doevents
inside your loop or place your loop code in a background worker thread.
Re: Monitoring a Variable [VB.net 2008]
Thanks, i tried done the background component, now i need to produce a status report while the event is being handled like. let say every 1 second. in a texbox it will say the word "Listening" to it and it will refresh oh let say 2 seconds.
since i can't just change the property of a textbox in the DoWork event of the BGW component, and the RunWorkerComplete event will only be initiated as soon as the task is done, or i purposely cancel the task. how do i go around this?
Re: Monitoring a Variable [VB.net 2008]
BGW has a FLAG that is used as a DELEGATE, which can be used to initiate code in both threads.
Re: Monitoring a Variable [VB.net 2008]
is there a sample code so that i can have a idea on how to do that?
Re: Monitoring a Variable [VB.net 2008]