电脑故障

位置:IT落伍者 >> 电脑故障 >> 浏览文章

限制文本框的输入(只输入数字)


发布日期:2020/4/4
 

文本框防止非法字符输入

只输入整数

Private Sub Text_KeyPress(KeyAscii As Integer)

Select Case KeyAscii

Case Asc(\\) To Asc(\\) vbKeyBack

\nop

Case Else

KeyAscii =

End Select

End Sub

只输入小数:

Private Sub Text_KeyPress(KeyAscii As Integer)

Select Case KeyAscii

Case Asc(\\) To Asc(\\) vbKeyBack

\nop

case Asc(\\)\允许一个小数点

If InStr( TextText \\) > Then KeyAscii =

Case Else

KeyAscii =

End Select

End Sub

上一篇:老生常谈:解释器模式

下一篇:NameValueCollectionValueProvider