[英]Textbox should allow only Integer. not decimal in vb.net
I want to allow only whole values and not decimal to the textbox in vb.net. 我想在vb.net的文本框中只允许使用整个值,而不能使用十进制。 Can anyone help me how to check validation on that.
谁能帮助我如何检查这一点。
Only allow numeric input: 只允许数字输入:
Private Sub TextBoxKeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox.KeyPress
e.Handled = True
If IsNumeric(e.KeyChar) Then e.Handled = False
End Sub
For a more elaborate example : http://msdn.microsoft.com/en-us/library/ms229644(v=vs.80).aspx 有关更详细的示例: http : //msdn.microsoft.com/zh-cn/library/ms229644(v=vs.80).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.