J
jp2msft
I'm displaying a form for our employees that requires them to log in before
they use it.
After they have been logged in and authenticated, the login form closes and
I tell the application to focus the text box that should accept input next.
Unfortunately, this never happens.
I can press the Tab key once, and focus goes immediately to the text box,
but it is not there by default.
Is there a trick to getting the cursor to default to a text box control
without requiring a Tab press?
If not, is there a way that I can capture any key that is pressed and copy
that to the text box?
If it makes a difference, this is an MDI Child form, but I don't see how
that matters.
My quasi code is as follows:
void LogYouIn()
{
using (LoginForm login = new LoginForm())
{
if (login.ShowDialog(this) == DialogResult.OK)
{
TextBox1.Focus();
}
}
}
they use it.
After they have been logged in and authenticated, the login form closes and
I tell the application to focus the text box that should accept input next.
Unfortunately, this never happens.
I can press the Tab key once, and focus goes immediately to the text box,
but it is not there by default.
Is there a trick to getting the cursor to default to a text box control
without requiring a Tab press?
If not, is there a way that I can capture any key that is pressed and copy
that to the text box?
If it makes a difference, this is an MDI Child form, but I don't see how
that matters.
My quasi code is as follows:
void LogYouIn()
{
using (LoginForm login = new LoginForm())
{
if (login.ShowDialog(this) == DialogResult.OK)
{
TextBox1.Focus();
}
}
}