Author Topic: Problem with basic indicator and DataSubscriber1  (Read 1190 times)

Lixoudis

  • Newbie
  • *
  • Posts: 14
    • View Profile
Problem with basic indicator and DataSubscriber1
« on: September 23, 2017, 03:41:36 AM »
Hello guys am fairly new on advanced HMI. First i will like to thank Archie for a well made program.
The issue am facing is that i built an hmi for remote viewing of a machine.Now i have a situation that i want to have a basic indicator with on(text shown indicator),green color status and off(text shown indicator),red color status. I have tried and use a DataSubscriber1 that is connected with the appropriate tag and then used the below code to have the affect i want but it didn't work.Any thoughts on this problem.


Code: [Select]
Private Sub DataSubscriber1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        If e.PlcAddress = True Then
            BasicIndicatorRefrigCompressor.Color1 = Color.Green
            BasicIndicatorRefrigCompressor.Text = "ON"
        Else
            BasicIndicatorRefrigCompressor.Color1 = Color.Red
            BasicIndicatorRefrigCompressor.Text = "OFF"
        End If
    End Sub


Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Problem with basic indicator and DataSubscriber1
« Reply #1 on: September 23, 2017, 06:47:13 AM »
Try it this way:

If e.Values(0) = "True" Then

Lixoudis

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Problem with basic indicator and DataSubscriber1
« Reply #2 on: September 23, 2017, 08:03:56 AM »
Thanks you very much Archie

Lixoudis

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: Problem with basic indicator and DataSubscriber1
« Reply #3 on: September 23, 2017, 02:21:25 PM »
Another question,I want for this project a DataSubscriber2 to run continuously even if the form is closed or hide.This subscriber will pull data and then a private sub will save these data to an sql database every minute?
Thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Problem with basic indicator and DataSubscriber1
« Reply #4 on: September 23, 2017, 06:42:40 PM »
If you right click the MainForm and select View Code, you will see a block of code with a comment saying that it is used to pause the updates when the form is hidden. If you comment out that code, it will continue to update even when the form is hidden. If the form is closed, then you have no way for a Datasubscriber to continue to work because you have shut it down completely by closing the form.