Validation in form
what is the code to validate user in making form such that textbox only accept 10 integers as phone no.???
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 attend5days leftRegister
Dipankar BiswasRank #992 · 2K reputationPosted Oct 29, 2014, 9:10 AM EDT
Code for Indian Formate Phone Number:
this code write in the txtPhnumbr_Validating Event
Regex phNum = new Regex("^\\+[9][1][-][\\d]{10}$");
Match getmatch = phNum.Match(textBox1.Text);
if (getmatch.Success)
{
errorProvider1.SetError(this.textBox1, "");
}
else
{
errorProvider1.SetError(this.textBox1, "Phnum Should 10 Digits and Format +91-XXXXXXXXXX");
}
See this link..
http://dotntcode.blogspot.in/2012/11/how-to-validate-textbox-with-indian.html
JUKE BOX20 reputationPosted Oct 29, 2014, 12:52 PM EDT
Dipankar BiswasRank #992 · 2K reputationPosted Oct 29, 2014, 9:11 PM EDT
errorProvider control.. example
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/UsingErrorProviderContolinWindowsFormsandCSharp11242005010829AM/UsingErrorProviderContolinWindowsFormsandCSharp.aspx
ErrorProvider.SetError Method
http://msdn.microsoft.com/en-us/library/system.windows.forms.errorprovider.seterror(v=vs.110).aspx