Sunday, June 12, 2005 7:36 PM
I was working with complex usercontrol with a grid and child usercontrols, which raises certain delegates (events). After in-depth code dubug, LostFocus event does not fire in same sequence, when control lost it's focus using KeyBoard or Mouse as specified in MSDN documentation.
The issue is:
When cancel property of the CancelEventArgs object is set to true in the Validating event delegate, all events that would normally occur after the Validating event are suppressed. It indicates that LostFocus fires "randomly" based on user's interaction with a control, so do not trust LostFocus event to raise everytime. Simply, As Microsoft recommanded, do not use LostFocus event. Alternatively use Leave, Validating or Validated events.