Value Change and Core.Api.DataSource.ValueChangedEventArgs

Post Reply
stasKanRich
Posts: 12
Joined: Tue Jun 05, 2018 12:10 pm

Value Change and Core.Api.DataSource.ValueChangedEventArgs

Post by stasKanRich »

Hello,

Looking to get the Value of the item before the change is made,ie:
take this example:
myObject has these values assigned to its value property and it is being changed by the user,
old value = 123;
new value = 432 ;

ValueChangedEventArgs documentation said i can get the "old value" from e but i cannot get it..

Code: Select all

void myObject_ValueChanged(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e)
		{
//e.Value - returns new value NOT OLD
//Microsofts new/old doesnt work aswell
//e.NewValue  - does not contain...(Error CS1061)
//e.OldValue   - does not contain...(Error CS1061)
//

}
i want to get 123 in e so can see what was there and what is there now (432).

i am probably missing a "using" or something silly like that but cant find it..
Thanks..

User avatar
Russ C.
Posts: 213
Joined: Thu Nov 16, 2017 3:32 pm
Contact:

Re: Value Change and Core.Api.DataSource.ValueChangedEventAr

Post by Russ C. »

You may have to use 2 different tags. One to store the old value and one for the current value and when that changes, set the old tag's value to the updated value.

Code: Select all

void myObject_ValueChanged(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e)
{

//
//do something here with oldMyObjectValue.Value
//

//set the old value tag to current value
oldMyObjectValue.Value = myObject.Value

}
Best regards,

Russ
(801) 708-6690
Technical Support
Contact Us

Beijer Electronics AB
http://www.beijerelectronics.us

Post Reply