Problems with Designer code

L

LightWarrior

Hello,

I created a form (form1) with an tabcontrol on it. This tabcontrol is
'protected'.
Now I create a new form (form2) and Inherit from form1. Now I can
modify the tabcontrol because of it is protected.

But now I get some problems. When I add some tabpages to the control
and then compile the program I got the error "Child is not a child of
control".

This is because in de Designer code of form2 the 'add-code' disappears
when I compile it. But the SetChildIndex-code is still there. So he
could not set the indexes of the pages because the pages are not childs
of the tabcontrol.

Now I add this code mannualy to the Designer:
"tabcontrol.tabpages.AddRange( ...)". When I compile it now, it will
work. But if I change something on form2 design-time. The error just
comes back.

Does anyone know what the problem could be?

GrtZ
Martijn S.
 
S

Stoitcho Goutsev \(100\)

Hi,

Maybe the best is to redesign your class. You cannot add manually any code
to the InitializeComponent beacuse the designer clears and regenerates this
method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top