Click here to Skip to main content
12,353,607 members (67,816 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
Hello Everyone,
If i have an event that happens always,
Application.Idle += Myevent;

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

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

Thanks in advance,
z3ngew
Posted 21-Jan-13 6:46am
z3ngew822
Edited 21-Jan-13 6:47am
v2
Comments
richcb 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
z3ngew 21-Jan-13 13:18pm
   
you are correct, thanks
Andreas Gieriet 21-Jan-13 13:25pm
   
The quality of the question is too low and you seem to be ignorant on requests to improve. My 1.
Andi
Sergey Alexandrovich Kryukov 21-Jan-13 15:22pm
   
Sorry, no. "Emulation" means something totally different. Not a valid question, honestly.
—SA

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,

Try this:
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.
  Permalink  
v2
Comments
Marcus Kramer 21-Jan-13 13:45pm
   
My 5
ProgramFOX 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
ProgramFOX 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100