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
Mike Pischke
NA
11
0
How to ignore a leave event when a cancel button is clicked
Aug 9 2010 9:49 AM
Consider this simple leave event from a text box control in a visual studio form:
private void dscr_Leave(object sender, EventArgs e)
{
if (dscr.Text == null)
MessageBox.Show("You must supply a description");
}
Assume there is a "cancel" button on the screen, and focus is in the "dscr" text box, and it's blank. You click the cancel button. As a beginner, I'm struggling on how to ignore this leave event when a cancel button is clicked. I've searched quite a while, and cannot find how to accomplish this. The leave event will fire before the click, but there's got to be some way to know the click event is coming, and avoid unnecessary validation. Can anyone point me to any examples of how to handle this situation, or direct me as to how to accomplish this?
Reply
Answers (
0
)
Screenshot from another device
Stackoverflow exception???