Esc in maskedtextbox

Is there any solution for the Esc keystroke to change text back to its last state Just like regular Textbox.




Answer this question

Esc in maskedtextbox

  • shubn

    Thanks for reply, but I am looking for a solution, not just an idea.
    I feel if it is easy, the feature would be built in.

    My concept is always that MS should take care of this kind of plumbing work, then we application developer can concentrate on business.

    But of cause, that is not practical based on we have seen so far from MS.

  • mbarbiero

    you can use the keypress event of the text box to check for the esc key and then code the desired effect!

  • lteska

    Trust me, I can come up with the code you gave,

    Where you are losing me is my point about MS.


  • wolka

    Wei,

    The idea is your solution....it is not easy and you will have to code your solution:


    Private Sub TextBox4_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress

    Dim MyString As String = TextBox4.Text

    If Asc(e.KeyChar) = Keys.Escape Then

    TextBox4.Text = MyString

    End If

    End Sub

     


    Don't know what you are trying to accomplish but that should give you an idea of how to proceed



  • Esc in maskedtextbox