HOW TO MAKE A TEXT BOX TO ACCEPT ONLY NUMBER BASED ON A CONDITION?

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
WPF 
WPF
 918  View(s)
Ratings:
Rate this:

How to make a textbox to accept only number? when my label.text is gms or rs or knot, then respective textbox accept only numbers. when label.text is character it has allow only character value.

Example:gms: 1200

        character:black

        knot:5

        rs:80

        character:pink

Thanks in advance.

  1. Sumit Kesarwani

    Post:378

    Points:2694
    Re: How to make a text box to accept only number based on a condition?

    Hi Ankit,


    Apply a regular validator on your text box with validation expression "^[0-9]" which accept only numbers initially make it disabled

    you can then enable disable it according to the text of your label making the text box to accept all or only numbers.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!