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

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
 
M

Morten Wennevik

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.
 
F

Frank Lee

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
 
M

Morten Wennevik

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top