473,508 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AddHandler needed in designer generated code

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?
Jul 21 '05 #1
5 1335
Can you not in some way put the AddHandler before the InitializeComponent call?
"Marina" wrote:
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?

Jul 21 '05 #2
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?

"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
Can you not in some way put the AddHandler before the InitializeComponent call?

"Marina" wrote:
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?

Jul 21 '05 #3
have you tried using custom serializers?

"Marina" <so*****@nospam.com> wrote in message
news:uB**************@TK2MSFTNGP11.phx.gbl...
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?

"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
Can you not in some way put the AddHandler before the InitializeComponent
call?


"Marina" wrote:
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?


Jul 21 '05 #4
I have no idea how to use them. Any links to tutorials?

"Joey Callisay" <hc******@codex-systems.com> wrote in message
news:Ox****************@TK2MSFTNGP10.phx.gbl...
have you tried using custom serializers?

"Marina" <so*****@nospam.com> wrote in message
news:uB**************@TK2MSFTNGP11.phx.gbl...
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?

"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
Can you not in some way put the AddHandler before the
InitializeComponent
call?


"Marina" wrote:

> 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?
>
>
>



Jul 21 '05 #5
have you browsed through Burke's sample at
http://msdn.microsoft.com/library/de...ustcodegen.asp

just to give you a start...

"Marina" <so*****@nospam.com> wrote in message
news:en**************@TK2MSFTNGP12.phx.gbl...
I have no idea how to use them. Any links to tutorials?

"Joey Callisay" <hc******@codex-systems.com> wrote in message
news:Ox****************@TK2MSFTNGP10.phx.gbl...
have you tried using custom serializers?

"Marina" <so*****@nospam.com> wrote in message
news:uB**************@TK2MSFTNGP11.phx.gbl...
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?

"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:B9**********************************@microsof t.com...
> Can you not in some way put the AddHandler before the

InitializeComponent
call?
>
>
> "Marina" wrote:
>
> > 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?
> >
> >
> >



Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1319
by: John Viele | last post by:
Every time I create ASP.NET pages that do any significant data access, I find myself having to deal with the same problems: managing data object creation, the SQL connection object especially. ...
4
1987
by: Mike | last post by:
Please help this is driving me nuts. I have 2 forms, 1 user class and I am trying to implement a singleton class. Form 1 should create a user object and populate some properties in user. Form2...
0
2452
by: MattO | last post by:
Here is the background information: *** *** *** *** *** *** *** *** In order to display enum string values in my application with localized values, I created a class called MyEnumConverter that...
7
2177
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
5
1148
by: Marina | last post by:
Hi, I have a component that implements ISupportInitialize, so the code in InitializeComponent is something like: theComponent.BeginInit() ' Set theComponent properties ...
12
7106
by: Tom | last post by:
I use dynamically created controls all the time. I.E. I create the control in code then use AddHandler to add the necessary delegates for processing (like Click, etc). Does one have to call...
13
5222
by: cj | last post by:
In a project done in 2003 about a year ago I was told to add the SocketWrench code below into the Windows Form Designer generated code area as shown below. #Region " Windows Form Designer...
2
1659
by: laxmibokka | last post by:
here im trying to create imagebuttons dynamically, and on click of button, the delete function should be called. actually commandargument is not passed into the imgBtn_Click im not getting any...
0
7118
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5049
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.