PC Review


Reply
Thread Tools Rate Thread

How do you set focus to a control

 
 
=?Utf-8?B?S2VsbHkgRHlrc3Rlcg==?=
Guest
Posts: n/a
 
      24th Feb 2004
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

 
Reply With Quote
 
 
 
 
jim
Guest
Posts: n/a
 
      24th Feb 2004
Hi Kelly,

in your forms load event...

\\\
TextBox1.Focus()
///

hope this helps,

jim
"Kelly Dykster" <(E-Mail Removed)> wrote in message
news:5508BC65-1FB5-4C56-B1D5-(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
=?Utf-8?B?S2VsbHkgRC4=?=
Guest
Posts: n/a
 
      24th Feb 2004
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.
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      24th Feb 2004
* "=?Utf-8?B?S2VsbHkgRHlrc3Rlcg==?=" <(E-Mail Removed)> 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)
 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      24th Feb 2004
* "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)
 
Reply With Quote
 
=?Utf-8?B?S2VsbHk=?=
Guest
Posts: n/a
 
      24th Feb 2004
Thanks for the great hint. That was my problem!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
emulating window.focus in Body onload() event and setting focus to a control on same page Jason Microsoft ASP .NET 4 7th May 2007 06:54 PM
giving control focus = Focus? Select? ActiveControl? Activate? Zytan Microsoft VB .NET 9 19th Feb 2007 01:42 AM
Control's, Focus, and Change focus Jon Slaughter Microsoft C# .NET 4 19th Nov 2006 12:31 PM
Losing focus on a slider control within a user control Israel Microsoft Dot NET 1 22nd Mar 2006 04:03 PM
Child control (in user control) regains focus when it is hidden! =?Utf-8?B?cmx0NjI0Ng==?= Microsoft Dot NET Framework Forms 0 14th Aug 2004 11:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:00 PM.