Where are the Form Properties for the AcceptButton and CancelButton for Visual Studio 2010? I'd like to set my btnClose as CancelButton and I'd like to set my btnEnter as my AcceptButton.

有帮助吗?

解决方案

The properties you are talking about are AcceptButton and CancelButton on the Form.

Make sure you select the Form in the form designer, and then look in the property panel.

Cheers

其他提示

Is this a windows form in VS 2010? Then you would make two buttons and associate actions in the code behind. Make two buttons, btnCancel and btnEnter and to generate codebehind simply double click the buttons in UI and provide the code.

Code for cancel button is something like:

void btnCancel_Close(object sender, System.EventArgs e){
    this.close();
}

Make sure your form derives from System.Windows.Forms.Form, then in the designer make sure you have the Form selected. In the Properties Window, the combo box should see something like

Form1 System.Windows.Forms.Form

Then under the Misc Grouping, you should see the AcceptButton and CancelButton properties that you can set to whatever buttons are on your form. Again, make sure the form is the selected component in the designer window.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top