AdvancedHMI Software

General Category => Open Discussion => Topic started by: fermin6032 on November 03, 2021, 08:39:00 PM

Title: assign to local variable c # the value obtained from BasicLabel
Post by: fermin6032 on November 03, 2021, 08:39:00 PM
I am working with AdvancedHMI but I am having trouble making the label "label3" take the value of basicLabel2.PLCAddressValue = "Channel1.PLC.DPS" which gets a Boolean value, I have tried various ways and have not succeeded.

I would also like to know how to assign to a c # variable the value of PLCAddressValue = "Channel1.PLC.DPS" instead of assigning it to a basicLabel.


 basicLabel2.PLCAddressValue = "Canal1.PLC.DPS";
 var valor = basicLabel2.Value;
 label3.Text = ""+valor;
Title: Re: assign to local variable c # the value obtained from BasicLabel
Post by: Archie on November 03, 2021, 09:31:06 PM
It sounds like you want to use a DataSubscriber instead of a BasicLabel. The DataSubcriber is essentially a BasicLabel without the visual part.

The code would look something like this:

    Private Sub DataSubscriber1_DataChanged_2(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber1.DataChanged
        Label1.Text = e.Values(0)
    End Sub
Title: Re: assign to local variable c # the value obtained from BasicLabel
Post by: fermin6032 on November 04, 2021, 03:29:28 PM
something like that, but how would I apply it in c#.

since I want to assign the value to a variable to perform an if condition.
Title: Re: assign to local variable c # the value obtained from BasicLabel
Post by: bachphi on November 04, 2021, 05:03:31 PM
First principle is do some basic reading.
There are plenty examples of DataSubscribe and how to.