473,607 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ 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 InitializeCompo nents() method, which
the designer places in the "...generat ed 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.ev ent
+="... but my question is where do you put this code if you're not supposed
to add to InitializeCompo nent()?

What I've done is created a CustomInitializ eComponent() and added its call
in the constructor right after the one to InitializeCompo nent().

Does that sound good?
Nov 16 '05 #1
1 1847
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
InitialiseCompo nent method for you.

"Daniel Billingsley" <db**********@N O.durcon.SPAAMM .com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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 InitializeCompo nents() method, which
the designer places in the "...generat ed 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.ev ent +="... but my question is where do you put this code if you're not supposed to add to InitializeCompo nent()?

What I've done is created a CustomInitializ eComponent() and added its call
in the constructor right after the one to InitializeCompo nent().

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 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...
1
1432
by: Vike_Fan_Forever | last post by:
I am having a problem that looks exactly the same as the below link. http://www.google.com/groups?hl=en&lr=&threadm=FBThr67iCHA.1884%40cpmsftngxa06&rnum=7&prev=/groups%3Fq%3Ddotnet%2B%2B0x80040202%26hl%3Den%26lr%3D%26selm%3DFBThr67iCHA.1884%2540cpmsftngxa06%26rnum%3D7 I was wondering if any one has ran into this problem, and has any reslolutions for it? I have tried all the suggestions from the above post, and it has not fixed my...
8
2318
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) My app (an image viewer) opens with a Main form with a file explorer if you open the program with the exe, but opens with the ImageView form if you double click an image file, if you want to see the Main form once the ImageView is open the...
9
1729
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 got a DOS box that showed some progress info. I then decided to add a form... So I made a new application and started with creating the form. Then I copied and pasted cpp code into places where I thought they should go - leaving out the stuff...
2
2373
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 expected. In the event code for that button, a new LinkButton is added to the page and is wired up to yet a different event, however when clicked, the page is posted back but the event is not triggered. I'm assuming it has something to do with the...
5
2372
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 application at run time this list should be generated again as the filtering criteria changes. So I clear the controls(labels) on the panel, get the list from the database and generate the list again. The list is created and it works fine. But sometimes...
8
36104
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 button on it. If the query returns multiple results, a new window is opened with a grid containing the results. When the user double clicks on the desired row in the grid, I want the first form to populate with the correct data. I don't know how...
3
1886
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 other events, which is not what I want. So, is there a simple way to turn off all events for a particular form, then turn them all back on? I know I can individually turn them off and on by using -= and += but that seems like a pretty brutal thing...
3
4675
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 form that has the System.Windows.Forms.LinkLabel controls on it is in a different project and under a different namespace from the file where the LinkLabel_LinkClicked events are, so I can't just do frm.ShowDialog under the LinkClicked method. ...
5
3067
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 (2008). I would rather do things this way than having to have a boolean flag to indicated to the handler to exit right away. Psuedo code: CacheHandlers(control)
0
8469
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
8463
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...
1
8128
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8322
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...
0
6803
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5997
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
3953
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4013
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1316
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.