L
Lars Black
I have a form that is created when my application starts. Whenever I want to
show the form, I call ShowDialog from my main form.
On the sub form, I have assigned the Activated event to a FormActivated
method. This is done to set some default values whenever the form is show'd.
The last thing in my FormActivated method is a SetFocus() on a textbox to
set the default focus to this control and also highlight (select) the text
in it.
Th problem is however, that is seems like something else is happening after
the Activated event has finished. I can see that the control is focused and
selected but only for a short while, the the form has no focused field
anymore.
private void InitializeComponent()
{
Activated += new System.EventHandler(FormActivate);
}
private void FormActivate(Object sender, EventArgs e)
{
teStartTime.Text = DateTime.Now.ToShortTimeString();
teStartTime.Focus();
}
What am I missing here?
Cheers,
Lars
show the form, I call ShowDialog from my main form.
On the sub form, I have assigned the Activated event to a FormActivated
method. This is done to set some default values whenever the form is show'd.
The last thing in my FormActivated method is a SetFocus() on a textbox to
set the default focus to this control and also highlight (select) the text
in it.
Th problem is however, that is seems like something else is happening after
the Activated event has finished. I can see that the control is focused and
selected but only for a short while, the the form has no focused field
anymore.
private void InitializeComponent()
{
Activated += new System.EventHandler(FormActivate);
}
private void FormActivate(Object sender, EventArgs e)
{
teStartTime.Text = DateTime.Now.ToShortTimeString();
teStartTime.Focus();
}
What am I missing here?
Cheers,
Lars