求助:为什么无法输入负数(基础的东西)
该段代码有什么问题呢?如果先输入一个"-"号后,就没法输入数值.
请教如何更改,卡住了.
Private Sub Command1_Click()
If IsNumeric(Text1.Text) Then
Select Case CLng(Text1.Text)
Case Is > 0
MsgBox "该数大于0", vbInformation, "答案"
Text1.Text = ""
Text1.SetFocus
Case Is < 0
MsgBox "该数小于0", vbInformation, "答案"
Text1.Text = ""
Text1.SetFocus
Case Is = 0
MsgBox "该数=0", vbInformation, "答案"
Text1.Text = ""
Text1.SetFocus
End Select
Else
MsgBox "请输入一个数值", vbExclamation, "提示"
Text1.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If Text1.Text <> "" And Not IsNumeric(Text1.Text) Then
Call Command1_Click
Else
Command1.SetFocus
End If
End Sub
谢谢