M
Marina
Hi,
I have a component that implements ISupportInitialize, so the code in
InitializeComponent is something like:
theComponent.BeginInit()
' Set theComponent properties
theComponent.EndInit()
Now, EndInit, needs to raise an event, such that the end developer can
handle it, and perform some other code to be done to the component, before
EndInit actually finishes it's work.
Now, the problem is that VB, uses the Handles clause to define event
handlers in the designer. The problem of course, is that this Handles,
doesn't hook up the event until InitializeComponent finishes - at which
point EndInit has been called, and the event fired and it is too late.
Now, in C#, the event handler is hooked up programmatically, and the
designer generates explicit code for this in InitializeComponent - so it
would work there.
Given that this is VB, is there any way to get the designer to generate
AddHandler code?
Any other workaround suggested?
I have a component that implements ISupportInitialize, so the code in
InitializeComponent is something like:
theComponent.BeginInit()
' Set theComponent properties
theComponent.EndInit()
Now, EndInit, needs to raise an event, such that the end developer can
handle it, and perform some other code to be done to the component, before
EndInit actually finishes it's work.
Now, the problem is that VB, uses the Handles clause to define event
handlers in the designer. The problem of course, is that this Handles,
doesn't hook up the event until InitializeComponent finishes - at which
point EndInit has been called, and the event fired and it is too late.
Now, in C#, the event handler is hooked up programmatically, and the
designer generates explicit code for this in InitializeComponent - so it
would work there.
Given that this is VB, is there any way to get the designer to generate
AddHandler code?
Any other workaround suggested?