Try sticking in
e.handled = true
somewhere in the code.
Main Topics
Browse All TopicsHi, I'm using VB.net and doing various validation on controls using the Validating event and setting the e.Cancel = true if the validation was unsuccessful.
This works fine on everything apart from when the user hits a tab on a tab control... its seems to fire the validating event 2/3 times but the tab still changes and an incorrect value is left stored in the control. Why should this happen, surely the tab control shouldn't receive the focus if I set e.cancel = true in the validating event...?
Any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Sorry...
I have a Textbox in which I'm doing some validation using the validating event. If the validation fails I set e.Cancel=true and the textbox does not lose the focus when clicking anywhere on the form.... except when clicking on a tab of a tab control...
Somehow the tab control seems to continue to work and switches pages, firing the validating event of the textbox a few times, but eventually losing the focus leaving an invalid value...
Does this make more sense?
Business Accounts
Answer for Membership
by: TheLearnedOnePosted on 2003-09-18 at 05:10:52ID: 9385536
This description is a little vague.
<< tab control shouldn't receive the focus if I set e.cancel = true in the validating event>>
The Validating event is when a control is about to lose focus.
The events occurs in this order:
Leave
Validating
Validated
LostFocus
So unless you are putting in e.Cancel=True in another control's Validating event, then the tab control will receive the focus.