有没有办法禁用在文本框中输入多行条目(即,我想阻止我的用户进行ctrl-enter以获取换行符)?
我能够使用KeyPress事件来做到这一点.这是代码示例:
Private Sub SingleLineTextBox_ KeyPress(ByRef KeyAscii As Integer) If KeyAscii = 10 _ or KeyAscii = 13 Then '10 -> Ctrl-Enter. AKA ^J or ctrl-j '13 -> Enter. AKA ^M or ctrl-m KeyAscii = 0 'clear the the KeyPress End If End Sub