I have many checkboxes on my form, I decided to create a custom checkbox to use instead.
I thought I could just change the following two lines of code in Mainform.designer.cs...
private System.Windows.Forms.CheckBox chkapp;
to
private CustCheckBox chkapp;

and

this.chkapp = new System.Windows.Forms.CheckBox();
to
this.chkapp = new CustCheckBox();

And I can, in that the code runs as expected with the additions of the custom check box.
But form designer does not like it and will not load, giving just the error "root element missing"
If I ignore it and continue, no controls show in form, they are all gone.

What am I missing that is causing this problem?

Thank you for taking the time to read?

Edited 9 Months Ago by Suzie999

You cannot rely on the designer in this case!
If you put a checkbox from the toolbox on the designer, care is taken that all the dreadful chores are updated in the designer.cs file.
Now you are on your own and have to do that yourself.
For instance did you add your new checkbox to the Controls collection of the form?

I only modified those 2 lines.
What is winding me up, is that in a bid to try to get to the bottom of it, I created a new forms project with two regular checkboxes, and followed the exact same procedure with one of them.
Code works as expected and the designer is happy with it too.

I'm a really slow, two finger typing, coder with 40 odd checkboxes in the various forms of my project, and really do not fancy sorting them all out individually.

Your reply was not the one I'd hoped for :( but I appreciate and thank you for it nonetheless.

I've tried all kinds of things suggested through a web search, such as deleting the csproj file in project root and a number of other things to no avail.

Edited 9 Months Ago by Suzie999

Additionally, when I try to view the settings area of my project properties, nothing shows, except, once again, my old friend "root element is missing" error.

I think there is more going on than just the manner in which I added the custom control.

Edited 9 Months Ago by Suzie999

I believe I found the problem.

In my solution explorer, under properties, settings.settings was an empty file somehow.
I added a new one from a blank project, and all seems fine now,

This question has already been answered. Start a new discussion instead.