all groups > dotnet windows forms designtime > october 2004 >
You're in the

dotnet windows forms designtime

group:

AddHandler needed in designer generated code


RE: AddHandler needed in designer generated code Bonj
10/8/2004 10:53:08 AM
dotnet windows forms designtime:
Can you not in some way put the AddHandler before the InitializeComponent call?


[quoted text, click to view]
AddHandler needed in designer generated code Marina
10/8/2004 1:30:29 PM
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?

Re: AddHandler needed in designer generated code Marina
10/8/2004 2:12:55 PM
The point is I want it to be generated somehow by the designer. This is a
component that end developers will use - and they shouldn't be going in to
do this by hand.

Like I said, if this was C#, this would not be an issue. But how can this be
done in VB?

[quoted text, click to view]

Re: AddHandler needed in designer generated code Marina
10/11/2004 10:00:58 AM
I have no idea how to use them. Any links to tutorials?

[quoted text, click to view]

Re: AddHandler needed in designer generated code Joey Callisay
10/11/2004 11:09:20 AM
have you tried using custom serializers?

[quoted text, click to view]

Re: AddHandler needed in designer generated code Joey Callisay
10/12/2004 9:26:28 AM
have you browsed through Burke's sample at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custcodegen.asp

just to give you a start...

[quoted text, click to view]

AddThis Social Bookmark Button