c# - Backspace only works once? -


i've got custom textbox-like control. i'm trying handle backspaces this:

    private void performbackspace() {         system.diagnostics.debug.writeline("got backspace. text \"{0}\".", (object)this.text);         string newtext = this.text.substring(0, this.text.length - 1);         system.diagnostics.debug.writeline("changing text \"{0}\".", (object)newtext);         this.text = newtext;         system.diagnostics.debug.writeline("text \"{0}\".", (object)this.text);     } 

in onkeydown call method, , works, 1 character. backspacing twice in row not work, have type @ least 1 character between backspaces reason. substring not working??? output when backspace twice:

got backspace. text "my textbox.".
changing text "my textbox".
text "my textbox".
got backspace. text "my textbox".
changing text "my textbox".
text "my textbox".

this quite possibly strangest issue have ever seen.

try calling onkeyup() event.


Comments