473,480 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how do you wire your own form control event handlers

If you double click on a control on a form in the designer it writes the
handler stub and links it for what I guess is considered the "default" event
of the control. Double-click on a form, for example, and you get a _Load()
handler. The link is handled in the InitializeComponents() method, which
the designer places in the "...generated code" region with the comments "...
do not modify the contents of this method...".

I know intellisense does most of the work for you if you type "control.event
+="... but my question is where do you put this code if you're not supposed
to add to InitializeComponent()?

What I've done is created a CustomInitializeComponent() and added its call
in the constructor right after the one to InitializeComponent().

Does that sound good?
Nov 16 '05 #1
1 1836
That sounds fine. Otherwise, you can view the list of events from the
properties window (click on a control, then click on the lightning at the
top of the properties window) and then you can see all of the available
events and add handlers as you wish; VS will then add these to the
InitialiseComponent method for you.

"Daniel Billingsley" <db**********@NO.durcon.SPAAMM.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
If you double click on a control on a form in the designer it writes the
handler stub and links it for what I guess is considered the "default" event of the control. Double-click on a form, for example, and you get a _Load() handler. The link is handled in the InitializeComponents() method, which
the designer places in the "...generated code" region with the comments "... do not modify the contents of this method...".

I know intellisense does most of the work for you if you type "control.event +="... but my question is where do you put this code if you're not supposed to add to InitializeComponent()?

What I've done is created a CustomInitializeComponent() and added its call
in the constructor right after the one to InitializeComponent().

Does that sound good?

Nov 16 '05 #2

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

Similar topics

1
302
by: Daniel Billingsley | last post by:
If you double click on a control on a form in the designer it writes the handler stub and links it for what I guess is considered the "default" event of the control. Double-click on a form, for...
1
1424
by: Vike_Fan_Forever | last post by:
I am having a problem that looks exactly the same as the below link. ...
8
2302
by: Tim Geiges | last post by:
Since I am being challenged with learning c# I figured I could pass some of the pain on to you guys :-) I have another question(this one is important for me to fix before I can get my app to Beta)...
9
1720
by: Piccolo Pete | last post by:
This is a bit "wordy", but here is the scoop. I'm using Microsoft Visual Studio for VC++ in Windows 2000. I made an application which had no form in it. So when I ran the application, I just...
2
2362
by: Chu | last post by:
Thanks everyone for taking a moment to read this. I've got a page where I use a LinkButton and I wire up a dynamic event to the button. When the user clicks the button, the event is fired as...
5
2352
by: moonie | last post by:
I have an msn style c# windows application with a form and panel on it. A news list is drawn from the database and dynamically added via labels, link lables during form loading. In this...
8
36056
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
3
1877
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
I have a form with a bunch (maybe 30) different controls that generate events when changed, clicked, etc. The various event handlers in turn might change some of these controls, thereby causing...
3
4661
by: bsturg21 | last post by:
Hello, I have a windows form that has a series of linklabels on it, and I need to have each linklabel, when clicked, open a separate windows form that has a single paramter passed into it. The...
5
3038
by: Lloyd Sheen | last post by:
Is there a way to get the event handlers such that I can cache the info about handlers for a particular control, remove the handlers, do some code and restore the cached event handlers in VB.NET...
0
7054
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
6918
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
7057
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
7102
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
6756
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
5357
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
3008
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
1310
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 ...
0
199
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.