Question: Code is VB.Net, Trying to restrict users from entering anything accept numbers into the text boxes using a CASE statement, but I keep getting System.EventArgs

Code is VB.Net, Trying to restrict users from entering anything accept numbers into the text boxes using a CASE statement, but I keep getting System.EventArgs errors.

My Code:

Protected Sub ValueBox1_TextChanged(sender As Object, e As EventArgs) Handles ValueBox1.TextChanged Select Case e.KeyChar Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", vbBack e.Handled = False Case Else e.Handled = True End Select End Sub

Errors = 'KeyChar' and 'Handled' are not members of 'System.EventArgs'

I have tried changing it to a KeyPress event

(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

but then the message changes to "KeyPress" cannot be found.

How can I restrict users from entering anything accet numbers??

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!