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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started