How would I limit to what characters can be entered into a textbox? I want to limit it to only "0123456789" and a Period.
How would I limit to what characters can be entered into a textbox? I want to limit it to only "0123456789" and a Period.
You need to add the case for the period.Code:Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Select Case Asc(e.KeyChar) Case 48 To 57, 8, 32 Case Else e.Handled = True End Select End Sub
Zomfg. And no, don't ask. - Dombo did it.
i love you+Rep x2
Edit: Sorry, nevermind, beat me to it
Last edited by Dr. Horrible; 02-24-2009 at 10:17 PM. Reason: Beat me to it
I'm a doctor, I've got a PHD in horribleness!