I'm not sure how this code is to be used, so I set up a test program with a single textbox and with newStr defined as a form-level string. I tried this code in both the textbox.KeyPress and Form.KeyPress handlers. In both cases it did the replacement but left the first character of the 4-char code within the textbox, which I fixed by adding a fourth chr(8) to the replacement string.
I could only get the routine to put in the extra "-" character by changing the code to use
Textbox.Text &= chr(8) ...
instead of SendKeys and, when I did this, it actually put the caret and the "-" character at the start of the text box!
I found that setting e.KeyChar=Chr(0) prevented the "-" character from appearing in the textbox.
I also simplified the string handling by removing the "n" & "tmpStr" variables and the for-loops and this is the code I ended up with;
Static newStr As String
newStr &= LCase(e.KeyChar)
If e.KeyChar = vbBack Then
newStr = If(newStr.Length > 1, newstr.substring(0, newstr.length-1), newStr)
End If
If newStr.Length = 4 Then
If newStr(3) = "-" AndAlso InStr("123-", newStr) Then
My.Computer.Keyboard.SendKeys(Chr(8) & Chr(8) & Chr(8) & Chr(8) & dicRepStr(newStr))
newStr = ""
Else
newStr = newStr.Substring(1)
End If
End If
Hope this helps.