TextBox Multi Undo/Redo Function

Apr 29 2011 6:30 PM
Hi Guys ,
Can you please let me know how I can have a several undo function on a text box?
For example, I have a textBox1 and a btn.Now I would like to redo the textbox value until to back to the very first value entered by user.
I tried this way but it didn't go through!
    private void btnUndo_Click(object sender, EventArgs e) {
    string iniVal = txtContext.Text;
    while (txtContext.Text != iniVal)
    {
      {
        txtContext.Undo();
      }
    }


Thanks for your time in advance

Answers (2)