Author Topic: assign to local variable c # the value obtained from BasicLabel  (Read 1486 times)

fermin6032

  • Newbie
  • *
  • Posts: 4
    • View Profile
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;
« Last Edit: November 03, 2021, 09:14:26 PM by fermin6032 »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: assign to local variable c # the value obtained from BasicLabel
« Reply #1 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

fermin6032

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: assign to local variable c # the value obtained from BasicLabel
« Reply #2 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.

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: assign to local variable c # the value obtained from BasicLabel
« Reply #3 on: November 04, 2021, 05:03:31 PM »
First principle is do some basic reading.
There are plenty examples of DataSubscribe and how to.
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================