How does one make a textbox highlighted with red color when an event occurred like invalid number format in c#?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not terribly clear what you mean, but it sounds like you want to do something like:
int.TryParse(rather than just parsing it and catching an exception)So something like:
(There may well be other rather more sophisticated ways of doinig this, including preventing the invalid input to start with… but for just changing the colour, this will work 🙂