TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Praveen Maurya
NA
146
26.8k
validating a textbox for 10 digit mob no.
Apr 14 2018 3:13 PM
i have created a textbox validation for 10 digit mob number but this is not working am i wrong anywhere
private void Validatemobnum(string Mobile)
{
Regex rx1 = new Regex("^[1-9]{10}");
if (rx1.IsMatch(Mobile))
{
throw new Exception("Only Numbers without decimal value are allowed");
}
}
i have creatted a method and calling at textbox leave event
private void addsuppliermob_Leave(object sender, EventArgs e)
{
try
{
Validatemobnum(addsuppliermob.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Please Check Mob ", MessageBoxButtons.OK, MessageBoxIcon.Error);
addsuppliermob.Text = "";
addsuppliermob.Focus();
return;
}
}
Reply
Answers (
2
)
Xamarin: System.Null Refrence Exception
Viewing Class In Windows Form Application