【发布时间】:2016-02-10 15:35:39
【问题描述】:
如果文本框为空并且我按退格键它崩溃并且突出显示的行是
TB1 = 左(TB1, Len(TB1) - 1)
我可以改变什么来阻止崩溃
Private Sub TB1_Change()
Dim strStrings As String, LastLetter As String
Application.EnableEvents = False
LastLetter = Right(TB1, 1)
strStrings = ","
If InStr(1, strStrings, LastLetter) > 0 Then
MsgBox LastLetter & " not allowed"
TB1 = Left(TB1, Len(TB1) - 1)
End If
Application.EnableEvents = True
结束子
这是一个文本框,其中“,”被限制。
【问题讨论】: