OnLoad called multiple times

  • Thread starter Thread starter allancady
  • Start date Start date
A

allancady

I'm getting started building a composite control, with my control being
derived from UserControl. For some reason, my override of
UserControl's OnLoad is being called four times for a single instance
of my control. I haven't been able to figure out why this is.

I had the same code implemented initially as a form in an exe, (instead
of deriving from UserControl), and I didn't have this problem. But now
that my control is in its own DLL library, it's doing this.

Anyone have any idea why?

Thanks,

Allan
 
Could you provide is with some code?

Gabriel Lozano-Morán
Software Engineer
Sogeti
 
Further investigation revealed that the unexpected calls to OnLoad()
are happening after the calls to EndInit() for each of the (now three)
component controls. This code is lifted from InitializeComponent():

((System.ComponentModel.ISupportInitialize)
(this.axPageLayoutControl)).EndInit();
((System.ComponentModel.ISupportInitialize)
(this.axTOCControl)).EndInit();
((System.ComponentModel.ISupportInitialize)
(this.axToolbarControl)).EndInit();

These controls are .NET-wrapped ActiveX controls from the ESRI
ArcObjects library. I don't know if this is a bug with the ESRI
library, or what. I'm too new with .NET to speculate. But as I said,
it only misbehaves if the containing control is a UserControl in a DLL.
I've sent a request to ESRI to inquire if they know anything about it.
 
Back
Top