to enter numeric values only(validation)

Posted on 2006-05-10
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

    Hello lincyelias,

    why not use the masked textbox for this purpose

    hope this helps a bit
    LVL 4

    Expert Comment

    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

    The time is coming for Beta 2 to quit working.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 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

    14 Experts available now in Live!

    Get 1:1 Help Now