只允许按下数字键和逗点

来源:互联网 发布:excel中工龄的算法 编辑:程序博客网 时间:2024/06/05 03:44
     Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

        If (e.KeyChar >= "0"c And e.KeyChar <= "9"c) Or (e.KeyChar = ".") Then
            e.Handled = False
        Else
            e.Handled = True
        End If

    End Sub
原创粉丝点击