Click here to Skip to main content
15,906,333 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys,
I have a small problem with button.?I have designed one form and placed only one button.When executing that form if i press space bar and enter key automatically that button functions are executing.What i want is when i click on button only it has to work.So can u plese reply wt to do as possible as early.



Thanks&Regards,
Sandeep
Posted

Because it is now the only control on your form it is automatically promoted as the default control. Simply set tab stop to false and only a click with the mouse will get it into action. Considering accessibility this isn't very good practice though.

Good luck!
 
Share this answer
 
Comments
#realJSOP 21-Apr-11 7:30am    
5 - proposed as answer.
sandeep.paruchuru 21-Apr-11 8:17am    
suppose if the form having more than one control den how to perform. I have a small favour how to set ACCEPTBUTTON and CANCELBUTTON property in property window.
Ankit Rajput 21-Apr-11 8:19am    
You will find both the properties in your form on which you have both the buttons.
Hi,

Use MouseClick Event instead of Click Event.

private void button1_MouseClick(object sender, MouseEventArgs e)


Regards
Ankit
 
Share this answer
 
v4
Comments
Toniyo Jackson 21-Apr-11 7:01am    
This will not work
Ankit Rajput 21-Apr-11 7:06am    
I have already test it before posting here.
Toniyo Jackson 21-Apr-11 7:09am    
Once you click on the button and then try Tab/Control.
Michel [mjbohn] 21-Apr-11 7:11am    
Some explanation on why it won't work would have been nice
Toniyo Jackson 21-Apr-11 7:14am    
Once you click on the button and then try Tab/Control.

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