'限制输入框只能输入数字 Public Sub KeyValid(KeyAscii As Integer) Dim strValid As String strValid = "0123456789.-" If KeyAscii > 26 Then If InStr(strValid, Chr(KeyAscii)) = 0 Then KeyAscii = 0 End If End If End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer) If (KeyAscii < 48 Or KeyAscii) > 57 Then KeyAscii = 0 End If End Sub
Public Sub KeyValid(KeyAscii As Integer)
Dim strValid As String
strValid = "0123456789.-"
If KeyAscii > 26 Then
If InStr(strValid, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
End If
End If
End Sub
If (KeyAscii < 48 Or KeyAscii) > 57 Then
KeyAscii = 0
End If
End Sub
strValid = "0123456789.-"
其中的"-"表示什么意思,通配符??
我是通过设置Text1.locked=true来控制MSFlexGrid的某些列不可编辑,不知道有没有其它更好的办法。
另外,我不知道是不是因为这个原因,导致在MSFlexGrid中敲回车时不能左右移动单元格,现在只能通过左右上下键来移动单元格。