473,659 Members | 2,671 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 ISupportInitial ize, so the code in
InitializeCompo nent is something like:

theComponent.Be ginInit()

' Set theComponent properties

theComponent.En dInit()

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 InitializeCompo nent 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 programmaticall y, and the
designer generates explicit code for this in InitializeCompo nent - 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 1343
Can you not in some way put the AddHandler before the InitializeCompo nent call?
"Marina" wrote:
Hi,

I have a component that implements ISupportInitial ize, so the code in
InitializeCompo nent is something like:

theComponent.Be ginInit()

' Set theComponent properties

theComponent.En dInit()

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 InitializeCompo nent 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 programmaticall y, and the
designer generates explicit code for this in InitializeCompo nent - 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**@discussio ns.microsoft.co m> wrote in message
news:B9******** *************** ***********@mic rosoft.com...
Can you not in some way put the AddHandler before the InitializeCompo nent call?

"Marina" wrote:
Hi,

I have a component that implements ISupportInitial ize, so the code in
InitializeCompo nent is something like:

theComponent.Be ginInit()

' Set theComponent properties

theComponent.En dInit()

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 InitializeCompo nent 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 programmaticall y, and the
designer generates explicit code for this in InitializeCompo nent - 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******** ******@TK2MSFTN GP11.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**@discussio ns.microsoft.co m> wrote in message
news:B9******** *************** ***********@mic rosoft.com...
Can you not in some way put the AddHandler before the InitializeCompo nent
call?


"Marina" wrote:
Hi,

I have a component that implements ISupportInitial ize, so the code in
InitializeCompo nent is something like:

theComponent.Be ginInit()

' Set theComponent properties

theComponent.En dInit()

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 InitializeCompo nent 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 programmaticall y, and the
designer generates explicit code for this in InitializeCompo nent - 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******@cod ex-systems.com> wrote in message
news:Ox******** ********@TK2MSF TNGP10.phx.gbl. ..
have you tried using custom serializers?

"Marina" <so*****@nospam .com> wrote in message
news:uB******** ******@TK2MSFTN GP11.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**@discussio ns.microsoft.co m> wrote in message
news:B9******** *************** ***********@mic rosoft.com...
Can you not in some way put the AddHandler before the
InitializeCompo nent
call?


"Marina" wrote:

> Hi,
>
> I have a component that implements ISupportInitial ize, so the code in > InitializeCompo nent is something like:
>
> theComponent.Be ginInit()
>
> ' Set theComponent properties
>
> theComponent.En dInit()
>
> 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 InitializeCompo nent 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 programmaticall y, and the
> designer generates explicit code for this in InitializeCompo nent -
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******** ******@TK2MSFTN GP12.phx.gbl...
I have no idea how to use them. Any links to tutorials?

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

"Marina" <so*****@nospam .com> wrote in message
news:uB******** ******@TK2MSFTN GP11.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**@discussio ns.microsoft.co m> wrote in message
news:B9******** *************** ***********@mic rosoft.com...
> Can you not in some way put the AddHandler before the

InitializeCompo nent
call?
>
>
> "Marina" wrote:
>
> > Hi,
> >
> > I have a component that implements ISupportInitial ize, so the code

in > > InitializeCompo nent is something like:
> >
> > theComponent.Be ginInit()
> >
> > ' Set theComponent properties
> >
> > theComponent.En dInit()
> >
> > 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 InitializeCompo nent 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 programmaticall y, and the > > designer generates explicit code for this in InitializeCompo nent -

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
1329
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. Problem 1: If I have a pile of data adapters on a page, I typically only need a single SQL connection object, though the designer always tries to add a new one for each data adapter. So I have to manually weed out the extras and set the data...
4
2001
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 should then have access to those user properties. I am not getting the property value from user that was set in form1. Sorry for posting so much code but I need help bad. How do i make this work? Thanks Mike
0
2461
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 derives from EnumConverter and will convert To and From localized string representations of an enum's values. Now, every enum whose values I desire to be displayed as localized strings have an attribute
7
2189
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 another. I have tried declaring them as shared, public, friend, etc and I always get an error stating that something is not valid on a local variable declaration. For example, in the following code for Sub DataGrid_Select, I have CurrentID and...
5
1155
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 theComponent.EndInit()
12
7130
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 RemoveHandler after processing is done? In other words, when the form is closing do I have to do a RemoveHandler for each one of the controls I created? Or can I just let .NET handle it when the form is closed and garbage collection is done? Tom
13
5241
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 generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer.
2
1669
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 errors but its not working plz help its very urgent thanx in advance
0
8339
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8751
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8629
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4338
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2757
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 we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.