How do I know System.Windows.Forms.TextBox in System.Windows.Forms lose Active?

  • Thread starter Thread starter Frank Lee
  • Start date Start date
F

Frank Lee

How do I know System.Windows.Forms.TextBox in System.Windows.Forms lose
Active?

I mean When a textbox get focus, then user click on another form/application
to make another form/application activate and make this form/application
deactivate, how to I know that in textbox? What event/message was sent to
textbox?

---Frank
 
Hi Frank,

The TextBox will never know as strictly speaking it's none of its business. The TextBox will only be notified if it loses focus to another control in the same form. You can use the Control.Leave event for this.

If your Form loses focus (ie clicking on another application) you can detect this in the Form.Deactivated event. You can then do something with the TextBox if needed.
 
Morten Wennevik said:
Hi Frank,

The TextBox will never know as strictly speaking it's none of its
business. The TextBox will only be notified if it loses focus to another
control in the same form. You can use the Control.Leave event for this.

If your Form loses focus (ie clicking on another application) you can
detect this in the Form.Deactivated event. You can then do something with
the TextBox if needed.

OK, it's a way.

However, for an IE Hosted usercontrol. How can I known IE loses focus?

---Frank
 
I'm afraid I don't know. You may want to start a new thread with this question.
 
Back
Top