根据Matt的建议,我使用了这个<pre>
- Private Sub txtLengthFt_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
- Select Case KeyAscii
- Case Asc("0") To Asc("9")
- Case Else
- KeyAscii = 0
- End Select
- End Sub
和此
- Private Sub txtLengthIn_Change()
- If txtLengthIn.Value >= 12 Then
- MsgBox "Whoa the Pony, Nothing greater than 12", vbCritical + vbOKOnly
- txtLengthIn.Text = "0"
- txtLengthIn.SelStart = 0
- txtLengthIn.SelLength = txtLengthIn.TextLength
- End If
- End Sub
检查数值。一旦填写了所有txtbox,并且基于上述两项检查有效,则会启用单击事件。(有两个以上的检查,我只是粘贴了其中的两个来显示我在做什么。所有6个框都有相同类型的错误验证。) |