Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hello Everyone,
If i have an event that happens always,
C#
Application.Idle += Myevent;


and if there is a variable that changes every time in this event,
C#
Myevent()
{
   var = value;
}


How can i capture old value and new value of this variable and then compare between,

Thanks in advance,
z3ngew
Posted
Updated 21-Jan-13 6:47am
v2
Comments
Richard C Bishop 21-Jan-13 12:48pm    
Use a session variable to capture the first one and compare that to the second one after taking it back out of session.
Richard MacCutchan 21-Jan-13 12:48pm    
What is var and where does value come from?
Sergey Alexandrovich Kryukov 21-Jan-13 12:49pm    
Not clear. The code you show will not compile, anyway...
—SA
z3ngew 21-Jan-13 12:51pm    
This is not my code, this is an emulation of it
Andreas Gieriet 21-Jan-13 13:07pm    
Please be so nice and take the time and make it a somehow working version - or do you expect us to spend that time for you?
Andi

1 solution

Hi,

Try this:
C#
int oldVar = aVar; // I use int in this example
                   // I also use aVar instead of var, because var is a keyword
int newVar = value;
// compare

aVariable = newVar;

Hope this helps.
 
Share this answer
 
v2
Comments
fjdiewornncalwe 21-Jan-13 13:45pm    
My 5
Thomas Daniels 21-Jan-13 13:57pm    
Thank you!
Andreas Gieriet 21-Jan-13 15:21pm    
My 5. What else to answer to the given question?
Andi
Thomas Daniels 22-Jan-13 12:36pm    
Thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900