Setting focus to a form

G

Guest

Hi,

I have an C# windows application running that has the property WindowsState
of the main form set to 'Minimized' and the property ShowInTaskBar set to
false. I've asingned a notifyIcon to the form that is show next to clock in
the lower rigth corner. When you click this notifyicon, I bring up a new form
(form2) with a textbox on it. I've set the textbox to TabIndex = 1, and a
blinking curson in the textbox shows that the textbox has the focus on the
form (form2), however the form itself (form2) does not have the focus from
the OS point of view, and I need to click on the top of the form (form2) in
order to activate the focus to the textbox.

I would like the new form (form2) to be immediately ready for input from the
keyboard at the moment where the form2 appears. It seems like a little
problem not worth writing all this text for, but I have two thousand
activations each day from 125 users that constantly ask me to resolve this
problem. Please help. I've tries Focus() in all kind of different places.

best regards
Jesper, Denmark
 
K

Kevin Spencer

Have you tried calling Activate() on the Form you're showing?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.
 

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