AnsweredAssumed Answered

Problems with Timer VB.Net and PI Server

Question asked by ManuelFco on Jan 12, 2018
Latest reply on Jan 29, 2018 by rdavin

Hi all,


I am reading PI data from VB.Net using a Timer to read them every 5 seconds, there is a tag that I read to detect if the machine is "stopped" or "working" this is inside an if:
public StopAuto As Boolean
if tags = stop then
StopAuto = False
Labelstatus.tex = "Working"
StopAuto = True
Labelstatus.tex = "Stopped"
end if


When StopAuto = True opens another form that contains a stopwatch and starts a stop time of the machine, now when StopAuto = false is because the machine started to work and the stopwatch stops and that time of the stopwatch is added to a listbox in the form. The problem is that since the first form is running the Timer1 to know if it is stopped or working the machine, every time that variable StopAuto = False this continues adding to the ListBox and I only want it to be added only once, unless StopAuto = True the stopwatch must initialize again and stop when StopAuto = false and so on

Can someone help me solve this?