Stupidly dumb question...

J

JamesB

Hello,
Just getting to grips with the .net side of things.
I have a login screen on my app, but I can't get my "login" button to be
default.

In old VB I could set focus to the username box so the user can type
straight in and tab to password then hit enter, but I don't see a "default"
property on command buttons any more, so the user then has to tab to the
button before hitting enter.

Any clues? I'm sure it's simple I just don't see it!
James
 
H

Herfried K. Wagner [MVP]

JamesB said:
That looks ideal, thanks.
Unfortunately it doesn't seem to work! I put this in my form load event:

Me.AcceptButton = cmdLogin

But nothing happens when I hit enter.
The button is located on a tab control but reading that page I dont think
it should cause a problem... I'll have a fiddle.

I am not sure why this doesn't work, but note that you can assign the button
to the form's 'AcceptButton' property at design time.
 
J

JamesB

Herfried K. Wagner said:
I am not sure why this doesn't work, but note that you can assign the
button to the form's 'AcceptButton' property at design time.

I fixed it - I had "causesvalidation" set on my password textbox so the
enter wasn't getting to the button.
Just spotted the property in the designer too thanks - dunno why I missed it
before.

Thanks to both of you.
 

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

Similar Threads

help with focus 1
Design question 1
How do I make a Button "active" for the Enter Key? 3
Windows 10 Itunes/TabKey 0
Dumb class question 3
methods for text box 2
default button in password recovery control 1
Enter Key behavior 8

Top