Post an example of the generated code, and the usercontrol code -- perhaps
for a single property. You may save yourself some grief by using separate
solutions for the usercontrol and the users of the usercontrol. In a post
build event copy the user control output to a separate folder, then
reference from there.
This is more work, but you can still debug the usercontrol by having the
debug mode for the usercontrol project set to application, the application
being devenv.exe, and have it start up with a test project using the
usercontrol by passing the path to the project on the command-line. This is
the only reliable way to debug design-time behavior.
It should be possible to eliminate your code serialization problems. Look
closely at ShouldSerialize and Reset methods, if you are not using the
DefaultValue attribute for properties.
Regards,
Frank Hileman
check out VG.net: www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor
> Hi,
>
[quoted text clipped - 19 lines]
> Thanks,
> Bernd
Bernd S - 28 Jun 2004 09:23 GMT
Following is an excerpt of the code generated by Visual Studio in the
InitializeComponent method of the outer user control 'this', after the inner
user control (called 'smfSerialEventUserControl1') has been dragged and
dropped onto it and then changing from design view to code view:
//
// smfSerialEventUserControl1
//
...
this.smfSerialEventUserControl1.Controls.Add(this.smfPopupContainerControl);
this.smfSerialEventUserControl1.Controls.Add(this.smfBusinessObjectPopupCont
ainerEdit);
this.smfSerialEventUserControl1.Controls.Add(this.cbRepeat);
...
At the same time two error messages appear in the task list which say that
code generation failed for property 'Controls' because of the object
reference was not set to an object instance.
This generated code is not correct because the three controls
'smfPopupContainerControl', 'smfBusinessObjectPopupContainerEdit' and
'cbRepeat' are not members of the outer user control 'this' but are
(private) members of the inner user control 'smfSerialEventUserControl1'.
Can you imagine what's going wrong here?
> Post an example of the generated code, and the usercontrol code -- perhaps
> for a single property. You may save yourself some grief by using separate
[quoted text clipped - 48 lines]
> > Thanks,
> > Bernd
Frank Hileman - 28 Jun 2004 19:01 GMT
It appears that the "inner" child controls somehow were added to the root
designer container for the outer control "this". This is not automatic --
there is some custom code written somewhere that gets the IContainer and
explicitly adds them, or they are added to the component tray, perhaps. Are
these inner controls exposed in some other way? I would look at the custom
control designer code.
Frank
> Following is an excerpt of the code generated by Visual Studio in the
> InitializeComponent method of the outer user control 'this', after the inner
[quoted text clipped - 5 lines]
> //
> ...
this.smfSerialEventUserControl1.Controls.Add(this.smfPopupContainerControl);
this.smfSerialEventUserControl1.Controls.Add(this.smfBusinessObjectPopupCont
> ainerEdit);
> this.smfSerialEventUserControl1.Controls.Add(this.cbRepeat);
[quoted text clipped - 10 lines]
>
> Can you imagine what's going wrong here?