Which event should I use for this?
It's not listed under TextBox property editor. Do you know why?
Joan Venge
2009-11-23 22:07:10
Just not shown in the property editor. You can add it from code behind. If Control.Leave is there as Johannes suggested you could use that as well.
Wil P
2009-11-23 22:12:13
It is not shown in the properties window because the event is marked with [BrowsableAttribute(false)] http://msdn.microsoft.com/en-us/library/system.componentmodel.browsableattribute.aspx
Martin Robins
2009-11-23 22:14:29
+3
A:
Control.Leave or Control.LostFocus:
When you change the focus by using the keyboard (⇆, ⇧+⇆, and so on), by calling the Select or SelectNextControl methods, or by setting the ContainerControl.ActiveControl property to the current form, focus events occur in the following order:
When you change the focus by using the mouse or by calling the Focus method, focus events occur in the following order:
If the CausesValidation property is set to false, the Validating and Validated events are suppressed.
Joey
2009-11-23 22:06:00
This is strange, when I lose the focus with mouse, I don't get Validated event to fire for some reason.
Joan Venge
2009-11-23 22:20:45
Some controls may not fire it; also CausesValidation may be set to `false`. And `Validated` is not strictly a focus event, as in, you shouldn't use it as a "focus lost" event. It's for validation purposes.
Joey
2009-11-23 23:10:25