Yes, but I want to have the control I loose the focus to, not the one where I loose the focus.
For example..if I loose the focus of a textbox to a button, I want to get the button.
Also, I only would have access to the textbox events in that case, I can not put events in every control. Is that possible?
I make it because I have a calendarScreen I close when I loose the focus, but I have a Button that oopens it.
And I want that the calendarScreen closes if the button is pressed when the it is open, and the problem is that it first closes because the focus is lost..and then the button opens it again instead of closing it.
btw. thanks for the answer ^_^
Main Topics
Browse All Topics





by: FernandoSotoPosted on 2007-08-20 at 10:15:23ID: 19731919
Hi dkloeck;
Connect all the Leave event handlers of the control to the event handler LostFocus as shown below. Then the last control to lose focus will be in the variable ControlLostFocus.
private Object ControlLostFocus = null;
private void LostFocus(object sender, EventArgs e)
{
ControlLostFocus = sender;
}
Fernando