473,387 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1332
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.