title: Handling KeyCode/KeyChar events in Windows Form TextBox Control
body: <p>I have various input textboxes on my form. And based on entries made in each of the input textboxes, I update the display textbox. However, using AppendText message of textbox. I have my input textboxes set to accept only numeric values. So for each character inputted correctly, I update the display Textbox. Problem I have is when user selects Key.Back or Key.Delete, what I would like to do is do a Delete of last character in the display textbox, but I am yet to get this right. How do I delete the last character in the string that is contained in a TextBox using AppendText() or any of the utility functions available in that control please? </p>
  
  <pre><code>If (e.KeyChar = ChrW(Keys.Back)) Then
                  txtDisplay.Text -= 1
                  txtDisplay.Update()
                  ElseIf (Not (Char.IsDigit(e.KeyChar) Or Char.IsControl(e.KeyChar) Or (e.KeyChar = "."))) Then
                      e.Handled = True
                  Else
                      txtDisplay.AppendText(e.KeyChar)
                  End If
  </code></pre>