By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,617 Members | 1,792 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,617 IT Pros & Developers. It's quick & easy.

Textbox focus again again

P: n/a
Last week I posted this for the first time. However, I didn't get any useable
solution to my problem. I'm very keen on getting this problem solved, so
please excuse me for trying again. I'll try to be a little more precise.

I have an app running (minimized) and without showing itself on the task
bar. It puts an icon in the task pane (next to the clock), and when I click
this icon, a message handler is invoked and creates a new usercontrol on the
screen. This usercontrol contains a textbox. This textbox is the problem.
When the usercontrol appears I would like to give input to the textbox
immediately. I use the focus() method but all that happens is that I get a
text-cursor (flashing in the textbox) and it looks like its ready for input.
However, when I type on the keyboard, nothing happens. I have to click
somewhere on the usercontrol for the textbox to capture input from the
keyboard. I do not think that focus method is the key to the solution, I've
tried several combination from various methods. It looks like the fokus
medthod works on application level - or form - level, and not on Operating
system level - is that correct, any solution to my problem.

Thank you,
Regards Jesper.

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Perhaps you need a WIN32() like SetFocus() from User32.lib.

Nov 17 '05 #2

P: n/a
1) Focus method is useless when a form is shown for the first time if you
correctly entered TabIndex fields for each component. The field that will
first have focus is the one with the value '0'.

2) However, with Focus method, it would have worked. Do you have 'Enter' or
'GotFocus' that set a focus in one of the parent chain of your textbox ? If
not, how do you show your form ? How do you set the focus ? To your textbox
or to your usercontrol ? Do you have a sample of your code that you could
provide ?

"Jesper" <Je****@discussions.microsoft.com> a écrit dans le message de
news:E8**********************************@microsof t.com...
Last week I posted this for the first time. However, I didn't get any useable solution to my problem. I'm very keen on getting this problem solved, so
please excuse me for trying again. I'll try to be a little more precise.

I have an app running (minimized) and without showing itself on the task
bar. It puts an icon in the task pane (next to the clock), and when I click this icon, a message handler is invoked and creates a new usercontrol on the screen. This usercontrol contains a textbox. This textbox is the problem.
When the usercontrol appears I would like to give input to the textbox
immediately. I use the focus() method but all that happens is that I get a
text-cursor (flashing in the textbox) and it looks like its ready for input. However, when I type on the keyboard, nothing happens. I have to click
somewhere on the usercontrol for the textbox to capture input from the
keyboard. I do not think that focus method is the key to the solution, I've tried several combination from various methods. It looks like the fokus
medthod works on application level - or form - level, and not on Operating
system level - is that correct, any solution to my problem.

Thank you,
Regards Jesper.

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.