Click here to Skip to main content
15,564,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

How to allow to input only negative and positive number in a textbox in C#.

Thanks & Regards

Mohd Wasif
Akinmade Bond 28-Nov-12 10:18am    
WinForm or WPF?
Pete O'Hanlon 28-Nov-12 10:24am    
What technology are you using? ASP.NET? Windows Forms? WPF?
Mohd Wasif 29-Nov-12 5:05am    
in Silver light

1 solution

One way to do this would be to handle the TextChanged event, parse the text to see if it passes your test, and update the Text property of the TextBox if necessary.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900