468,490 Members | 2,640 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,490 developers. It's quick & easy.

How do you set focus to a control

HI
A very simple question. I like to set the focus to a TextBox when the forms opens. How do you do that in Vb.net
Thanks in Advance

Kelly Dykste

Nov 20 '05 #1
5 31168
jim
Hi Kelly,

in your forms load event...

\\\
TextBox1.Focus()
///

hope this helps,

jim
"Kelly Dykster" <an*******@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
HI,
A very simple question. I like to set the focus to a TextBox when the forms opens. How do you do that in Vb.net. Thanks in Advance.

Kelly Dykster

Nov 20 '05 #2
Thanks jim, but i have tried it and it desn't do what i like it to do. I want when the form opens the IBeam Cursor start at the textbox and texbox.focus doesn't do it for me.
Nov 20 '05 #3
* "jim" <james_matthews_at_shi_dotcom> scripsit:
in your forms load event...

\\\
TextBox1.Focus()
///


'Load' is executed before the form is shown, so no focus can be set.

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

..NET FAQs: <http://www.mvps.org/dotnet/dotnet/faqs/> (German)
Nov 20 '05 #4
* "=?Utf-8?B?S2VsbHkgRHlrc3Rlcg==?=" <an*******@discussions.microsoft.com> scripsit:
A very simple question. I like to set the focus to a TextBox when the forms opens. How do you do that in Vb.net.


Assign the control the lowest 'TabIndex' on the form.

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

..NET FAQs: <http://www.mvps.org/dotnet/dotnet/faqs/> (German)
Nov 20 '05 #5
Thanks for the great hint. That was my problem!
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Karl Irvin | last post: by
1 post views Thread by tlemcenvisit | last post: by
1 post views Thread by clickon | last post: by
1 post views Thread by amjad | last post: by
4 posts views Thread by Jon Slaughter | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.