hi there
i have a question

i have created the login in C# deshtop application

and when the application ruins i have amde the cursor to be focused to the username textbox
now the thing is soemtimes the user
adds the username and then adds the password a

and then press Enter

but my application does not work for that
how can i make that enabled

thanx

Recommended Answers

All 3 Replies

There is a built in property for this matter :)

Form b = newForm();
b.AcceptButton = btnLogin;//btnLogin represents the button you ahve to press to go forward.

In your case, it's probably :

this.AcceptButton = btnLogin;

Note that you can also set the AcceptButton of your form in the Designer View. Simply click your form and look at the propertie windows, its somewhere in there :)

Hope this helps

or on the end of some code do:

this.btnLogin.Focus();

this should put the focus on login button. So after checking the user`s name and password, user can press the button with pressing Enter key.

Hope it helps,
Mitja

There is a built in property for this matter :)

Form b = newForm();
b.AcceptButton = btnLogin;//btnLogin represents the button you ahve to press to go forward.

In your case, it's probably :

this.AcceptButton = btnLogin;

Note that you can also set the AcceptButton of your form in the Designer View. Simply click your form and look at the propertie windows, its somewhere in there :)

Hope this helps

hey thanxx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.