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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipankar BiswasPosted Oct 30, 2014, 1:11 AM
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
JUKE BOXPosted Oct 29, 2014, 4:52 PM
Dipankar BiswasPosted Oct 29, 2014, 1:10 PM
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