0

I have one project with my forms, etc. and one DLL-Project with UserControls and extended Controls, all with .Net4.5.1 and WinForms. A few weeks ago I did a migration from VS-Net2013 but the custom controls I'm talking about did not exist at that time. With every edit in my form inside Designer the new Form.Designer.cs is missing the instantiation of my custom gridview. All other parts regarding this control are still in the designer-code.

public class RichGridView : DataGridView { ... }

The missing part in Form.Designer.cs is:

            this.dataDGV = new RichGridView(Definitions.DataType);

I can put this line back for myself into the designer-code but that's not how it should be. I was checking whether there are other files where VS might store information about the controls handled in its designer file but didn't found something. A while ago the designer has thrown away that line only a couple of times, so I could edit my form in the designer-window without problems and very seldom the instantiation was thrown away, now with every edit.

The other Project containing the DLL with my custom controls was compiled successfully and available for my Forms-Project, furthermore there was no change at all in the other project. If the point is that the custom control is outside the Forms-Project: I had to do this due to constraints in VS when dealing with UserControls regarding 32 vs 64 bit and debugging possibilities.

Not sure if there is some part of my code necessary for this question.

Sundancer
  • 536
  • 1
  • 4
  • 12
  • Is it somehow related to absence of parametless constructor ([click](http://stackoverflow.com/q/1784303/1997232))? You shouldn't edit Form.Designer.cs manually and your controls must have parameterless constructor. – Sinatr Feb 19 '15 at 14:02
  • so why did it work at the beginning and VS did not throw it away everytime like now? The parameter is just an property with an enumtype, being set, not more logic there. I was thinking about this but hardly to do without that propertry. Also there are a few WinForm-Controls instantiated with parameters in the designer code. Why is this working? – Sundancer Feb 19 '15 at 14:16
  • Do you mean components (`Timer`, menu, etc.)? Because they require `IContainer` to be properly disposed by form. – Sinatr Feb 19 '15 at 14:19
  • System.Drawing.Size(866, 173); System.Drawing.Point(3, 27); System.Windows.Forms.TreeNode("Controlling"); ... Even though there's a param in my constructor just setting the type but not more logic and if this is working without this param, fine but hard to understand because I can edit the form and run it, also I can edit my custom control in forms, debug, etc. If the designer can't work with my constructor it should not give the possibility to edit my control in the form. – Sundancer Feb 19 '15 at 14:27

0 Answers0