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
hadoop hadoop
NA
159
50.8k
validation of user input instantly when user leaves the text
May 21 2015 12:52 AM
I want validation module to work when the user leaves the textbox or the textbox is out of focus. i.e. when the user input in one textbox and then focus on other textbox for input instantly error message should popup if the previous input is not valid.
Suppose ::
Username :: //txtUsername
Phone :: //txtPhone
here error message should popup instantly for txtName if it is invalid when txtName is out of focus.
I've develop a module for validation but it works when the form is complete,i.e. only at the save time.
#region "Input Validations"
private bool IsClientValid()
{
if (txtUsername.Text == string.Empty || txtUsername.Text == null)
{
MessageBox.Show("User Name is required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
if (txtUsername.Text.Length > 200)
{
MessageBox.Show("User Name cannot be more than 200 characters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
if (txtPhone.Text.Length > 20)
{
MessageBox.Show("Phone Number cannot be more than 20 characters", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
return true;
}
#endregion
Reply
Answers (
4
)
Values Are Not Getting Stored From Combo box to Data Base
How to find the mac id for windows xp using c# code