这总是一个痛苦的问题,也是一个很常见的问题。我通常的管理方法是使用KeyPress事件:-
Private Sub nudInsertFTS_KeyPress(sender As Object, e As KeyPressEventArgs) Handles nudInsertFTS.KeyPress, nudInsertTS.KeyPress, nudInsertFTL.KeyPress, nudInsertTL.KeyPress, nudInsertTTS.KeyPress, nudInsertTTL.KeyPress
' Reset The Timer
Functions.ResetTimer()
'If certain characters then allow
If e.KeyChar = vbBack Then Exit Sub
' do not allow the comma character (or any other invalid characters)
If e.KeyChar = "." Or e.KeyChar = "-" Or IsNumeric(e.KeyChar) = False Then e.KeyChar = Chr(0)
End Sub
忽略函数。重置计时器-这是一个防止应用程序关闭的功能。我的客户希望应用程序在10分钟不活动后关闭。