# Re: 急件..请问两个问题

Posted by Danice on March 16, 1999 at 16:30:10:

In Reply to: 急件..请问两个问题 posted by sdy on March 16, 1999 at 16:11:55:

1. 写在text_keypress内
glb_numberonly keyascii
其中 glb_numberonly 为一 sub, 写法如下
Public Sub glb_numberonly(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
SendKeys "{tab}"
KeyAscii = 0
End If
If KeyAscii < vbKey0 Then
Exit Sub
End If
If KeyAscii > Asc("9") Or KeyAscii < Asc("0") Then
MsgBox "只可输入０到９", , "错误讯息"
Beep
KeyAscii = 0
End If
End Sub

2. 可以写在 text2_lostfocus 内
if lenb(trim(text1.text)) > 0 and lenb(trim(text2.text))> 0 then
command.enabled=true
endif

Follow Ups: