★在.net里面可以用简单的代码,就能够限...... 在.net里面可以用简单的代码,就能够限制文本框的输入(只能够输入数字),我们可限制只输入整数、只能输入小数等。以下为代码示范: 只输入整数: Private Sub Text1_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case Asc("0") To Asc("9"), vbKeyBack 'nop Case Else KeyAscii = 0 End Select End Sub 只输入小数: Private Sub Text1_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case Asc("0") To Asc("9"), vbKeyBack 'nop case Asc(".")'允许一个小数点 If InStr(1, Text1.Text, ".") > 0 Then KeyAscii = 0 Case Else KeyAscii = 0 End Select End Sub |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-30 07:28 , Processed in 0.173965 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.