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
Priya M
NA
42
11.4k
RegularExpression
Feb 4 2016 5:33 AM
Hello,
In text box i want to allow character,Number,Special Symbols like \ . ,-'
And also remove wrong character when i click on Messagebox.
Here is my code
private void txtPNo_TextChanged(object sender, TextChangedEventArgs e)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(txtPNo.Text, "^[a-zA-Z0-9]*$"))
{
MessageBox.Show("This Textbox accepts only Alphabetes & Numeric Value");
txtPNo.Text.Remove(txtPNo.Text .Length -1);
}
}
////error
txtPNo.Text.Remove(txtPNo.Text .Length -1);//This line could not return anything
if first character is wrong then length is 0 and it causes error
Reply
Answers (
1
)
How to check duplicate record in MS Access Database 2007
Running .Net Exe from another project