Textbox with blinking cursor does not receive key input

H

huli

In our Windows Forms app we are having an issue that our login dialog
(a System.Windows.Forms.Form) does not always receive focus. In this
case the cursor blinks in the textbox however the field does not
receive any key inputs and therefore does not display any text entered.
The user needs to click manually in the textbox which is obviously not
the ideal option.

I would appreciate any suggestions on this topic.

huli
 
K

Kevin Spencer

How about setting the focus on the TextBox?

--
HTH,

Kevin Spencer
Microsoft MVP
Digital Carpenter

A man, a plan, a canal,
a palindrome that has gone to s**t.
 
S

Stoitcho Goutsev \(100\)

huli,

How do you get a blinking caret in a text box that doesn't have the focus?
Can you post a sample code that demostrates the issue?
 
H

huli

Stoitcho:
How do you get a blinking caret in a text box that doesn't have the focus?

That's what we would like to know too. Displaying a new form usually
sets the focus on the first control. That's what we expect but not get
all the time.
Can you post a sample code that demostrates the issue?

The code in not very interesting. We are just creating a login dialog
like:

[STAThread]
static void Main() {

//....

LoginDialog l = new LoginDialog();
while(! User.IsLoggedIn)
if(l.ShowDialog() == DialogResult.Cancel) {
Application.Exit();
return;
}

//....
}

The LoginDialog itself is - as I mentioned above - a simple Windows
Form with 2 Labels and 2 Textboxes. Thats it.
The issue is also not reproducable. Sometimes it works just fine.


Kevin:
Where would you set the focus? We haven't made good experience with
manually setting focus altogether.

thanks
huli
 

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