7/23/2019 3:50 PM | |
Joined: 3/15/2017 Last visit: 8/26/2024 Posts: 6 Rating:
|
Hello, I am trying to access a textbox value programmed in visual studio in the tia portal and it always stays at 0 and does not update in real time. Could you tell me how to "update" that value? Code: public partial class ButtonAndViewer: UserControl { Int16 iValue1 = 0; //Cashing the value / Wert Zwischenspeichern [Description("Press button")] public event EventHandler Event1; [Description("Value will be show in the IO-Field"), Category("Data")] public Int16 Value1 { get { return iValue1; } set { iValue1 = value; //Set IO-Field to current value / Setzt EA - Feld auf aktuellen Wert ioFieldValue1.Text = iValue1.ToString(); } } public ButtonAndViewer() { InitializeComponent(); ioFieldValue1.Text = Value1.ToString(); } private void button1_Click(object sender, EventArgs e) { iValue1 += 1; ioFieldValue1.Text = Value1.ToString(); if (this != null) this.Event1(this, e); } private void Button2_Click(object sender, EventArgs e) { iValue1 -= 1; ioFieldValue1.Text = Value1.ToString(); if (this != null) this.Event1(this, e); } private void Button3_Click(object sender, EventArgs e) { iValue1 = 0; ioFieldValue1.Text = Value1.ToString(); if (this != null) this.Event1(this, e); } } Thank you. Greetings.
------------------------------------------------------------------------------------------ |
Last edited by: Jen_Moderator at: 07/24/2019 08:40:42New subject after splitting |
|
Follow us on