I am wanting to add a indication that data is being updated when a form is opened so that the user only sees valid data. Also this indication would serve as a "loss of comms" indicator. I added a basiclabel to my form that is present for 3 seconds and reads a register in the controller that holds the month. If this value is greater than zero then hide the message else show the BasicLabel64. Code below
Private Sub DGC1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
BasicButton1.Hide()
BasicButton2.Hide()
BasicLabel64.Show()
Timer2.Enabled = True
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
If ModbusTCPCom1.Read(40700) > 0 Then ' read month from controller
BasicLabel64.Hide()
Else : BasicLabel64.Show()
End If
End Sub
This seems to work great until I actually get a loss of comms then I get the attached exception. what am I doing wrong? Thanks