AdvancedHMI Software
General Category => Open Discussion => Topic started by: sts69 on March 06, 2017, 09:39:42 PM
-
Hello programmers,
is the following possible by code or similar?
I would like to activate / deactivate an acoustic alarm with a "CheckBox". The Alarm comes by DI Tag-address (for example, 10001).
This is certainly possible with a datasubscriber, I just do not know how :-(
Thank you for your support
Steffen
-
- Add a Checkbox to the form
- Add a DataSubscriber
- Set PLCAddressValue to 10001
- Double click the DataSubscriber to get back to the code
- Enter this code:
if (e.ErrorID=0) AndAlso (e.Values IsNot Nothing) AndAlso (e.Values.Count>0) then
If CheckBox1.Checked and e.Values(0)="True" then
Dim player as New System.Media.SoundPlayer
player.SoundLocation = ("C:\Windows\Media\Alarm01.wav")
player.Play()
End If
End If
You could also modify the SoundPlayer and give it an Enabled property.
-
Hello Archie,
Many Thanks. This works perfectly :-)
Steffen
-
"You could also modify the SoundPlayer and give it an Enabled property."
That would be great, but how does it work?
Steffen