473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Textbox focus again again

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
2 1985
Perhaps you need a WIN32() like SetFocus() from User32.lib.

Nov 17 '05 #2
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JayDee | last post by:
After a user enters data into a field, I need to populate other controls on the form, based on the user entry. I have to use either Leave, Validating or Validated, and I take it I can't use...
3
by: Jose Egea | last post by:
Hello: I'm trying to execute a function when the user press Enter key in a TextBox. But something is happening in my form because after pressing a button, when I press the Enter key in the...
0
by: SpotsPlay | last post by:
If I bind a TextBox to a property on a "BusinessObject", the first time that TextBox is edited (each time the form/user control is opened) hitting Tab or clicking on another control on the...
4
by: melanieab | last post by:
Hi, I need to write something so that when a textbox is entered (this is for a touchscreen), all the text in that textbox is selected (highlighted) and new keystrokes replace the old text. Help!...
1
by: Gill Smith | last post by:
when the page is loaded I am using onload event at the client side and setting the focus on the control(TextBox). However when the user clicks on Clear ImageButton, I am clearing all the text boxes...
4
by: JC | last post by:
Hello- I have a form which has a listbox, a textbox and a submit button. The user types a phone number into the textbox, clicks button, text gets added to the listbox. After this process I need...
1
by: melanieab | last post by:
Hi again, I have a textbox where the text is longer than the textbox width. When I type something in there or even do any single keystroke (other than tab, up, down, or enter) and then leave, the...
8
by: cj | last post by:
I asked this question a couple of days ago but am just now looking at it again. I used to use the textbox gotfoucs event to have all the text in the textbox selected when it gotfocus. That...
8
by: nil | last post by:
Hello all, It's urgent... i want to add autocomplete textbox facility in my application like google. as you type it suggests option to the user..i want the same kind of facility...i know i...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.