Hello all, I have a text box that I only want the user to be able to enter number type entries. I want them to be able to enter 1, -1, or 1.1 but not one. I have this right now but it doesn't allow me to enter a decimal or a neg sign.....Can anyone tell me how I can use this code or some other keypress code to limit the user imput?
Protected Sub textbox_OnKeyPress(ByVal Sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles textbox.KeyPress
'Validate that the only thing the user can enter is a number
If [Char].IsNumber(e.KeyChar) OrElse AscW(e.KeyChar) = CInt(Keys.Back) Then
e.Handled = False
e.Handled = True