Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i want wpf validation like
Textbox (Include Char and Numbers & Starts with Char)
Textbox(only numbers)
i don't have permissions to open all site pls post the code
thank you
Posted
Comments
Sandeep Mewara 5-Jul-12 2:11am    
What have you tried so far? You ask for code but have not shared any effort made from your side.
Roman Lerman 5-Jul-12 2:11am    
If you need to restrict the input, look here http://stackoverflow.com/questions/1346707/validation-in-textbox-in-wpf

No one is going to post any code for you.

Go through each of these articles and try implementing validation logic on your own.

WPF Validation[^]
Validation in Windows Presentation Foundation[^]
http://wpftutorial.net/DataValidation.html[^]
 
Share this answer
 
C#
 int a;
 if(!int.TryParse(yourtextbox.Text,out a))
{
   error go here
}
else
{
  yourtextbox.text=a;
}
 
Share this answer
 
Comments
CHill60 1-Dec-13 8:23am    
The question is over a year old and the OP specifically also said "Textbox (Include Char and Numbers & Starts with Char)" - your code only validates for integers only, not numbers

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