about Focus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi,all

I have a control ,when the control gets foucs.
I do not want to lost focus unless this control release focus by self.

How to do it?

thanks
 
Capture the lostFocus event of the control and use a bool flag to see if the control should lose focus or not. For example:

private void Control_LostFocus(object sender, System.EventArgs e)
{
if(!loseFocus)
((Control)sender).Focus();
}

You will have to manage the bool (loseFocus) throughout your code.
 

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

Back
Top