Page 1 of 1

Value Change and Core.Api.DataSource.ValueChangedEventArgs

Posted: Wed Jun 20, 2018 10:50 am
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..

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

Posted: Tue Jun 26, 2018 11:10 am
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

}