all groups > dotnet windows forms > august 2006 >
You're in the

dotnet windows forms

group:

Problems with Designer code


Problems with Designer code LightWarrior
8/31/2006 4:44:09 AM
dotnet windows forms:
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.
Re: Problems with Designer code Stoitcho Goutsev (100)
8/31/2006 9:41:56 AM
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.


--
Stoitcho Goutsev (100)

[quoted text, click to view]

AddThis Social Bookmark Button