473,385 Members | 1,642 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,385 software developers and data experts.

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 817
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
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
by: Vike_Fan_Forever | last post by:
I am having a problem that looks exactly the same as the below link. ...
8
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
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
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
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
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
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.