I have an ActiveX control I have dropped onto my main Windows form. After pressing F5 to start debugging I have found two different behaviors. The first is good execution resulting in the application starting. The second results in my Main_Load event never starting. After some inspection it appears the problem is in my main form designer at the line shown below.
((System.ComponentModel.ISupportInitialize)(this.axMbSlaveV71)).EndInit();
I placed a break on this line and the line immediately after. I get to the axMbSlaveV71.EndInit line, but I rarely get to the line after. I have also attempted stepping into, but nothing different ever happens there. I am also confused as to how this could work sometimes and not work other times.
From what I have read it seems that the BeginInit and EndInit allow a control to be loaded without any of the control events firing.
The main form designer contains this code for the axMbSlaveV71 control:
((System.ComponentModel.ISupportInitialize)(this.axMbSlaveV71)).BeginInit();
this.axMbSlaveV71.Enabled = true;
this.axMbSlaveV71.Location = new System.Drawing.Point(509, 290);
this.axMbSlaveV71.Name = "axMbSlaveV71";
this.axMbSlaveV71.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axMbSlaveV71.OcxState")));
this.axMbSlaveV71.Size = new System.Drawing.Size(100, 50);
this.axMbSlaveV71.TabIndex = 75;
this.axMbSlaveV71.Visible = false;
((System.ComponentModel.ISupportInitialize)(this.axMbSlaveV71)).EndInit();
I appreciate any help with this.