Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my form there are many controls are there and i want to make focusable one button as a default button. when i am pressing enter at that time cursor goes to next button and reaches at the last then it should be go to that one button not by coding with the use of property
Posted
Updated 12-May-16 7:22am
Comments
Sergey Alexandrovich Kryukov 9-Mar-12 1:07am    
First, you need to tag your UI library and type of application. WPF, Forms, ASP.NET? What?
Default button is a concept of a dialog or a window/form shown as a modal dialog. Only.
--SA

You can use Form.AcceptButton property for this purpose. An example is given here

http://msdn.microsoft.com/en-us/library/system.windows.forms.form.acceptbutton.aspx[^]
 
Share this answer
 
v2
Comments
Maciej Los 9-Mar-12 11:17am    
My 5! But need a comment. If OP has many of controls, he need to set TabIndex property too.
ProEnggSoft 9-Mar-12 11:43am    
Thank you Iosmac
Using The AcceptButton Property, it will be default selected button in the form.

AcceptButton:- ButtonName
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900