VB Code:
  1. If Len(txtTextBox) > 10 Then
  2.      txtTextBox.Text = Left(txtTextBox, 10)
  3.      txtTextBox.SelStart = Len(txtTextBox)
  4. End If