Solved

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

Posted on 2016-09-03
2
24 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

772 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