且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在文本框中按Tab键时如何触发事件?

更新时间:2023-12-03 08:32:34

TextBox还有一个 AcceptsTab 属性,当 Multiline = True

The TextBox also has an AcceptsTab property that works when Multiline = True.

有了这些条件,您现在可以看到是否按Tab键:

With those conditions, you can now see if the tab key was pressed:

Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) _
                             Handles TextBox1.KeyDown
  If e.KeyCode = Keys.Tab Then
    e.SuppressKeyPress = True
    'do something
  End If
End Sub