简体   繁体   中英

The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified.

I am getting this error when i open the design of a Winform.

Message 1244 The designer cannot process the code at line 108: this.cancelButton.DialogResult = DialogResult.Cancel; The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.

But when either i remove this piece of code from the designer.cs or change it to

this.cancelButton.DialogResult = System.windows.Forms.DialogResult.Cancel;

it works. My problem is i have this problem at almost all the winforms over a solution at many places. How can i resolve this issue to all places? Any way?

@zespri和@bansi的建议是不错的选择,但是建议您在InitializeComponent()之后在构造函数中进行所有自定义的构造时间设计。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM