2 Replies - 2042 Views - Last Post: 09 February 2010 - 09:29 AM Rate Topic: -----

#1 systemerror   User is offline

  • D.I.C Head

Reputation: -19
  • View blog
  • Posts: 205
  • Joined: 15-August 09

C# Back-Track

Posted 08 February 2010 - 09:46 PM

How would I back track something like theres 4 labels and there back colour is white at the start then you click a button to turn them all blue and the you make another button how do you make it back track when you click the button (green), so you wont need to type
label1.backcolor = color.white;


can anyone plz help?
Is This A Good Question/Topic? 0
  • +

Replies To: C# Back-Track

#2 Martyr2   User is offline

  • Programming Theoretician
  • member icon

Reputation: 5612
  • View blog
  • Posts: 14,686
  • Joined: 18-April 07

Re: C# Back-Track

Posted 08 February 2010 - 11:06 PM

Well as you may know controls don't keep a history of their states by default. This means that if you wish to keep track of a control's previous states, you will have to some how store that state information. That way when you want to go back, you can simply look up the previous state information and reset the control that state. The beauty of this is that you also get the option to move forward with state as well so you can go back and forth much like an Undo or Redo option in a graphics program.

I suggest you check out the use of an arraylist to store this information about controls you wish to save. But as for default, there isn't anyway to go back except for physically setting it with the color.

:)
Was This Post Helpful? 1
  • +
  • -

#3 MentalFloss   User is offline

  • .
  • member icon

Reputation: 619
  • View blog
  • Posts: 1,590
  • Joined: 02-September 09

Re: C# Back-Track

Posted 09 February 2010 - 09:29 AM

You may want to take a look at this pattern:

http://www.dofactory...ernCommand.aspx

It's used for what you're after which I understand to be undo functionality.

Hope this helps.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1