Easy Friday Question

  • Thread starter Thread starter Mike D
  • Start date Start date
M

Mike D

I have a login webform page built in C#. How do I set the cursor into the
username Text Box when the page is first loaded. This way the user doesn't
have to mouse click into the field and then start typing.

Thanks
Mike
 
First, you should check the TabIndex of every control on your form that
accepts user inputs, and of the labels for those controls. (The tab
index of the label should be just before the tab index of the control.)

That way, when your user presses the Tab key, they will cycle through
the controls on the form in a logical order, and if the tab indexes on
your labels are set correctly, the ALT+letter keyboard shortcuts should
also take the user to the correct field.

After all of that, I believe that when a form comes up it sets focus to
the control on the form with the lowest tab index.

If not, you can call textBox1.Focus() in the Load() event of your form.
 
Back
Top