Solved

Textbox key down event to check for number and letter and decimal

Posted on 2016-09-03
2
20 Views
Last Modified: 2016-09-05
Hello,
I have a function to do a check on keydown event of a textbox ,
how can I have it for only letters,numbers and decimal points
  Public Sub GenericTextBoxFilter(sender As Object, e As KeyEventArgs)
        If TypeOf sender Is RadTextBox Then
            Dim tb = DirectCast(sender, RadTextBox)
            MessageBox.Show(e.KeyValue.ToString())
            If (e.KeyValue.ToString()) = 192 Then
                e.SuppressKeyPress = True
                e.Handled = True
            End If
        End If
    End Sub

Open in new window

0
Comment
Question by:RIAS
2 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 41783409
https://msdn.microsoft.com/en-us/library/system.windows.forms.control.keypress(v=vs.110).aspx

Use the KeyPressed event instead.  The link has example code
0
 

Author Closing Comment

by:RIAS
ID: 41784394
Thanks Andy as always!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now