2
Answers

TextBox Multi Undo/Redo Function

Behrouz Hosseini

Behrouz Hosseini

13y
5.9k
1
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)