[Last Call] Learn how to a build a cloud-first strategyRegister Now


to enter numeric values only(validation)

Posted on 2006-05-10
Medium Priority
Last Modified: 2010-04-23

i am using Microsoft Visual Studio 2005 Beta 2. in my project i have 10 forms. In some textboxes of that forms i want to enter numeric values only ie;character can not be entered. how i do these validation(by using function)
Question by:lincyelias
LVL 44

Expert Comment

ID: 16648140
Hello lincyelias,

why not use the masked textbox for this purpose

hope this helps a bit

Expert Comment

ID: 16648658
I use the keypress event for this

   Private Sub txtIPS1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIPS1.KeyPress

            Select Case e.KeyChar
                Case "0" To "9", ControlChars.Back
                    'do nothing
                Case Else
                    e.Handled = True
            End Select

        Catch ex As Exception
            MsgBox(Err.Description & " M8")
        End Try

    End Sub
LVL 96

Accepted Solution

Bob Learned earned 120 total points
ID: 16650293
The time is coming for Beta 2 to quit working.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 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