3
votes

I'm using C#.Net and have a base form that is inherited by several forms.

Until yesterday, when the child (derived) form was opened in the designer the base forms controls would be displayed and shown as locked.

Now, however the form is simply blank. None of the base forms controls are visible in the designer. Everything compiles, builds and runs OK.

Has anyone else seen this?

I've tried placing a call to the base forms InitializeComponent method in the derived forms OnLoad method but to no avail.

2

2 Answers

5
votes

Found solution in a SO post I did not see before posting the question.

Essentially, I needed to place a call to InitializeComponent() in the private no argument constructor of my base form.

private ItemSelectForm()
{
    InitializeComponent();
}

The base form then needs to be rebuilt.

0
votes

Disappearance of my controls from my form, is an experience I have undergone, too. Somewhere, maybe on MSDN, I read, do not change the InitializeComponent(), but leave it, untouched and unaltered, to the machine to compile that part of the code. Well, I have often attached and changed and taken away delegates, successfully, inside the InitializeComponent() method, but this time I wanted to feed a parameter into it: InitializeComponent(string x), to give a different name to a control, unknowingly about the effect that the controls would disappear from sight, while still being operative at runtime. After reading this page, I have taken away now that little parameter x, and try to do the job outside the InitializeComponent() method, and the controls have reappeared, immediately. Hope this helps, even if I have no extensive code to add and reasons to give.