I have a textobx that appears on a tab page. I'm trying to set the focus on
that textbox but it doesn't seem to work. The focus always defaults to a
button that is on the form (but not on the tab page).

Any ideas? I tried focusing on the tab page and then on the text box to no
avail.

Thanks,
- Kevin

Re: TextBox.Focus() doesn't focus by hirf-spam-me-here

hirf-spam-me-here
Thu May 13 01:22:06 CDT 2004

* "kwarnke" <nospam@nowhere.com> scripsit:
> I have a textobx that appears on a tab page. I'm trying to set the focus on
> that textbox but it doesn't seem to work. The focus always defaults to a
> button that is on the form (but not on the tab page).

Are you sure the form and the controls are visible when calling the
textbox's 'Focus' method?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Re: TextBox.Focus() doesn't focus by Andrew

Andrew
Wed May 19 14:27:54 CDT 2004

Try instrumenting the code with the control's "CanFocus" property to see
whether it CAN get the focus ?

--
****************************************************************************
andrewbingham.com

tel 01223 514674 (Cambridge)
mobile 07970 161057
fax 07970 601283
email Andrew@AndrewBingham.com

DISCLAIMER, PLEASE NOTE:
This communication is for the attention of the named recipient only
The content should not be passed on to any other person.
It is sent in good faith, in confidence, and without legal responsibility.

VIRUS CHECK
Emails and attachments are virus checked using Norton® AntiVirus®
2002 which is regularly updated. However it remains the recipients
responsibility to check emails and attachments sent, or forwarded,
from andrewbingham.com for viruses and macro viruses
****************************************************************************
"kwarnke" <nospam@nowhere.com> wrote in message
news:OaepOnJOEHA.2876@TK2MSFTNGP09.phx.gbl...
> I have a textobx that appears on a tab page. I'm trying to set the focus
on
> that textbox but it doesn't seem to work. The focus always defaults to a
> button that is on the form (but not on the tab page).
>
> Any ideas? I tried focusing on the tab page and then on the text box to
no
> avail.
>
> Thanks,
> - Kevin
>
>



Re: TextBox.Focus() doesn't focus by Justin

Justin
Wed May 19 16:50:59 CDT 2004

Focus returns true/false success. Note that synchronous ordering when working
with controls can sometimes cause your values to get reset. If you are calling
the Focus method from within an event handler, try using:

private delegate bool BooleanMethodInvoker();
public void Some_EventHandler(...) {
myTextBox.BeginInvoke(new BooleanMethodInvoker(myTextBox.Focus));
}

An examination of using the invoke methods can be found here:
http://weblogs.asp.net/justin_rogers/articles/126345.aspx

--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Andrew Bingham" <Andrew@AndrewBingham.com> wrote in message
news:%23jmqFedPEHA.1548@TK2MSFTNGP10.phx.gbl...
> Try instrumenting the code with the control's "CanFocus" property to see
> whether it CAN get the focus ?
>
> --
> ****************************************************************************
> andrewbingham.com
>
> tel 01223 514674 (Cambridge)
> mobile 07970 161057
> fax 07970 601283
> email Andrew@AndrewBingham.com
>
> DISCLAIMER, PLEASE NOTE:
> This communication is for the attention of the named recipient only
> The content should not be passed on to any other person.
> It is sent in good faith, in confidence, and without legal responsibility.
>
> VIRUS CHECK
> Emails and attachments are virus checked using Norton® AntiVirus®
> 2002 which is regularly updated. However it remains the recipients
> responsibility to check emails and attachments sent, or forwarded,
> from andrewbingham.com for viruses and macro viruses
> ****************************************************************************
> "kwarnke" <nospam@nowhere.com> wrote in message
> news:OaepOnJOEHA.2876@TK2MSFTNGP09.phx.gbl...
> > I have a textobx that appears on a tab page. I'm trying to set the focus
> on
> > that textbox but it doesn't seem to work. The focus always defaults to a
> > button that is on the form (but not on the tab page).
> >
> > Any ideas? I tried focusing on the tab page and then on the text box to
> no
> > avail.
> >
> > Thanks,
> > - Kevin
> >
> >
>
>