1

In a winforms application I have a MyForm.cs that starts to get quite large. To solve this I have created a new file(MyForm.LeftPanel.cs) using partial class of the MyForm class with a subset of the GUI functionality.

However once in a while, not always, when I go into the designer all event handlers that I have moved to MyForm.LeftPanel.cs gets regenerated in MyForm.cs with empty functions. This obviously causes compiler error until I manually remove them in MyForm.cs.

How can I prevent these functions from being regenerated?

I saw a question about Placing these kind of files under the main.cs in the project, could this be the solution that would tell visual-studio to find the existing functions?

Community
  • 1
  • 1
hultqvist
  • 17,451
  • 15
  • 64
  • 101

1 Answers1

1

Using the method in WinForm partial classes I placed MyForm.LeftPanel.cs below MyForm.cs.

So far this seem to have solved the problem.

Community
  • 1
  • 1
hultqvist
  • 17,451
  • 15
  • 64
  • 101