Focus Lost on Form Change

  • Thread starter Thread starter Juan
  • Start date Start date
J

Juan

Hello:

I Created some forms in my application, but Have the problem that when I
return from a form, the focus doesn't pass to the parent form , the focus
get lost and I had to click on the parent form to force it to return.

If I click in the "ok" button of the parent form, the event get enqueued,
but doesn't occur, until I click on the form itself.
I tried with "this.Focus()" (on parent form), but it doesn't work, the
focused property of the parent form is well set to TRUE before this point,
but it hasn't the focus.

sample code:

form test = new form();
test.ShowDialog();

test.Dispose(); // here the focus should be in the parent form

test = null;

Application.DoEvents(); //i tried with this, but dont works

this.Focus(); //parent form


How can I solve this problem?

I want the focus to return automatically to the parent form.
Is this a bug?

Thanks a lot.


Juan
NTSMobile
 
Thanks, but this doesn't work.
I've been trying some things and the problem is the event model on .NET
Compact Framework.
I changed the event in where I load the new form, the event was
SelectedIndicesChanged of a listview, I changed it and put ItemActivated and
the problem was solved.
 
Back
Top