473,511 Members | 16,282 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?
Nov 21 '05 #1
5 1148
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?

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

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


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



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



Nov 21 '05 #6

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

Similar topics

2
1320
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. ...
5
1336
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 ...
4
1988
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...
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
1660
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...
1
7085
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...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5671
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3227
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
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
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
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
449
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.