How do we perform validations in windows forms,except writing IF conditions is there any easy way or method to write Validations...please explain me...it's very helpful for me in my project
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 23, 2013, 2:51 AM EDT
rajiv reddy j4 reputationPosted Sep 23, 2013, 2:56 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Sep 23, 2013, 3:02 AM EDT
asp.net validation control will not work in windows form.
for asp.net check this link
http://www.c-sharpcorner.com/uploadfile/puranindia/validation-controls-in-Asp-Net/
Satyapriya NayakRank #47 · 31.5K reputationPosted Sep 23, 2013, 9:21 AM EDT
Hemant SrivastavaRank #581 · 4.2K reputationPosted Sep 23, 2013, 2:09 PM EDT
private void textBox1_Validated(object sender, EventArgs e)
{
if (Convert.ToInt32(textBox1.Text) <= 0)
{
MessageBox.Show("Invalid Number");
}
}
Similarly we could use regular expression (Regex) to check data validation too.