[入力可能な文字バイト数を設定する] by じゃんぬ http://uno036.starfree.jp/PRGmanual/vsnet_tips/textbox/maxbytelength.html http://jeanne.wankuma.com/library/maxbytelengthtextbox/source.html
Private Sub txtS1_TextChanged(sender As Object, e As EventArgs) Handles txtS1.TextChanged Dim strS1 As String = "" Dim intLen As Integer = 0 Dim intLenB As Integer = 0 Dim s_jis As System.Text.Encoding = System.Text.Encoding.GetEncoding("Shift_JIS")
If intLenB > 10 Then Do Until intLenB <= 10 strS1 = strS1.Substring(0, intLen - 1) intLen = Len(strS1) intLenB = s_jis.GetByteCount(strS1) Loop txtS1.Text = strS1 txtS2.Focus() End If End Sub