473,405 Members | 2,154 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,405 software developers and data experts.

Remove Event Handle dynamically in C#

How can I remove a event handle dynamically?

I knew that, it is the proper way to add a event handler for a control

Add Handler
-----------------------------------------------
this.button1.Click += new System.EventHandler(this.button1_Click);

Remove Handler
------------------------------------------------
button1.Click -= new System.EventHandler(button1_Click);

But I want some other way which is more easy, which doesn't need to
supply the old method pointer(name) in the procedure..

A good example is like example below ( written in Delphi )
button1.onClick := nil;

Does anyone can help me or give me a hint. TQ...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #1
2 5702
Have you tried the syntax RemoveHandler object.EventA, AddressOf
Me.EventHandler
--
data mining and .net team
http://www.visual-basic-data-mining.net/forum
"Jensen Hoh" <so*******@yahoo.com> wrote in message
news:uS**************@TK2MSFTNGP11.phx.gbl...
How can I remove a event handle dynamically?

I knew that, it is the proper way to add a event handler for a control

Add Handler
-----------------------------------------------
this.button1.Click += new System.EventHandler(this.button1_Click);

Remove Handler
------------------------------------------------
button1.Click -= new System.EventHandler(button1_Click);

But I want some other way which is more easy, which doesn't need to
supply the old method pointer(name) in the procedure..

A good example is like example below ( written in Delphi )
button1.onClick := nil;

Does anyone can help me or give me a hint. TQ...

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #2
Jensen,

Any reason why you ask this in the VBNet newsgroup?

Cor.

Nov 21 '05 #3

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

Similar topics

21
by: Alo Sarv | last post by:
Hi From what I have understood from various posts in this newsgroup, writing event loops pretty much comes down to this: while (true) { handleEvents(); sleep(1); // or _sleep() or...
2
by: Linda | last post by:
Hi, How do I dynamically add linkbuttons and wire them to same event? I am able to add linkbuttons but they do not fire the event. Does anybody have a working sample? Many thanks, Linda
4
by: Anatoly | last post by:
Put any control on web page. create Init event for ths control. Write Response.Write("here") inside this event. Compile\build\run. I never saw "here" string appear on web page. Why???
0
by: luca | last post by:
Hi all. My problem is that I can't handle events raised from child components within a composite server control when the control is created dynamically. Everything works fine if the same control...
5
by: Jon B | last post by:
Hi There! How to handle the events of a dynamically added user control? e.g. I have following code... Dim myUserControl as Object = LoadControl("myFirstControl.ascx") myFirstControl fires...
4
by: Charles Law | last post by:
Is there a way to dynamically remove an event handler from an event without knowing the name of the handler? For example, how can ClassB remove the handler without knowing the name, or how many...
5
by: =?Utf-8?B?TWFyYyBXb29sZnNvbg==?= | last post by:
Hi, I have a strange issue occurring with LinkButtons that are dynamically added to each (data) row of my DataGrid on that grid's ItemDataBound event. Each LinkButton is assigned its own event...
3
by: =?Utf-8?B?ZWFndWlsYXI=?= | last post by:
Hi, I am trying to dynamically generate a menu, based on entries on a text or xml file. The text file contains the "tree" after which the menu will need to be created. Something like the...
3
by: Allen Chen [MSFT] | last post by:
Hi Richard, Quote from Richard================================================== However I also want to be able to remove the panes. I have tried to include this, but find that when I first...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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,...

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.