I currently have a DataSubscriber with DataChanged event. Depending on the value , it will display the selected picture.
Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
Select Case e.Values(0)
Case "0"
PictureBox2.BackgroundImage = My.Resources.AdvancedHMILogoBR
Case "1"
PictureBox2.BackgroundImage = My.Resources.AdvancedHMILogoBR
Case "2"
PictureBox2.BackgroundImage = My.Resources.AdvancedHMILogoBR
Case "3"
Now, let's say when it's case "1", I'd like to display more than one picture, that is pic1 for 2 seconds, pic2 for 2 seconds, then repeat the sequence as long as the value is still at "1"
so I modified case "1" like below:
Case "1"
While e.Values(0) = 1
PictureBox2.BackgroundImage = My.Resources.Pic1
Application.DoEvents()
Sleep(2000)
PictureBox2.BackgroundImage = My.Resources.Pic2
Application.DoEvents()
Sleep(2000)
End While
This works as intended, but as my e.values changes, different pictures are not displaying. Do you see anything wrong with the code? TIA