精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● VB和Basic>>判断用户输入的只能是数字的另一方法~

主题:判断用户输入的只能是数字的另一方法~
发信人: magiccai(乜SPN辉姐)
整理人: winsy(2003-04-29 16:55:55), 站内信件
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If Chr(KeyAscii) = vbBack Or Chr(KeyAscii) = "." Then Exit Sub
If Not IsNumeric(Chr(KeyAscii)) Then
    Beep
    KeyAscii = 0
    StatusBar1.Panels("addinfo").Text = "Must be numric."
End If
End Sub

* StatusBar1.Panels("addinfo").Text = "Must be numric."
加多一条提示栏。

[关闭][返回]