Thanks to Jan and BIBD. I created a public section based on your answer, which can be reused.
Public Sub PreventNewlines(ByRef KeyAscii As Integer)
If KeyAscii = 10 Or KeyAscii = 13 Then KeyAscii = 0
End Sub
Private Sub textbox_KeyPress(KeyAscii As Integer)
Call PreventNewlines(KeyAscii)
End Sub
Screen flickering should never be a problem, since these are processed events, not a constant poll (and this additionally limits the area to one control). It seems to me a wrong argument, since each text editor executes some code for each keystroke.
thank
source
share