How do you set focus to a control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Hi Kelly,

in your forms load event...

\\\
TextBox1.Focus()
///

hope this helps,

jim
Kelly Dykster said:
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 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.
 
* "=?Utf-8?B?S2VsbHkgRHlrc3Rlcg==?= said:
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.
 
* "jim said:
in your forms load event...

\\\
TextBox1.Focus()
///

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top