Only accept digits for textbox

前端 未结 8 928
小鲜肉
小鲜肉 2020-12-10 16:13

I found this code for making my textbox only accept numbers.

Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.Key         


        
8条回答
  •  醉梦人生
    2020-12-10 16:43

    When I have had the requirement of an input which only accepts numbers, I have typically used the NumericUpDown class. It handles limits and decimals too.

提交回复
热议问题